Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Praktische Anwendungen (Showcase)
    4. Radar2 läßt sich nicht mit root rechten ausführen

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    Radar2 läßt sich nicht mit root rechten ausführen

    This topic has been deleted. Only users with topic management privileges can see it.
    • Thomas Braun
      Thomas Braun Most Active @necromonger last edited by Thomas Braun

      @necromonger Die capabilities hast du aber gesetzt?

      sudo setcap cap_net_admin,cap_net_raw,cap_net_bind_service=+eip $(eval readlink -f `which arp-scan`)
      sudo setcap cap_net_admin,cap_net_raw,cap_net_bind_service=+eip $(eval readlink -f `which node`)
      sudo setcap cap_net_admin,cap_net_raw,cap_net_bind_service=+eip $(eval readlink -f `which arp`)
      sudo setcap cap_net_admin,cap_net_raw,cap_net_bind_service=+eip $(eval readlink -f `which hcitool`)
      sudo setcap cap_net_admin,cap_net_raw,cap_net_bind_service=+eip $(eval readlink -f `which hciconfig`)
      sudo setcap cap_net_admin,cap_net_raw,cap_net_bind_service=+eip $(eval readlink -f `which l2ping`)
      

      Dann sollte nämlich eigentlich sowas im log erscheinen:

      2020-07-25 20:20:09.180  - info: radar2.0 (4367) debug: arp-scan -lgq --retry=5 --timeout=400 --interface=wlan0 executed for 6.934 seconds and returned 25 hosts.
      
      1 Reply Last reply Reply Quote 1
      • N
        necromonger last edited by

        Hab mich als root angemeldet und gesetzt. Ist dies so korrekt?

        Thomas Braun 1 Reply Last reply Reply Quote 0
        • Thomas Braun
          Thomas Braun Most Active @necromonger last edited by Thomas Braun

          @necromonger Nein, als root wird sich nicht angemeldet. Außer du hast da Docker auf einer Synology laufen. Was ist das für eine Hardware auf der du da rumspringst?

          1 Reply Last reply Reply Quote 0
          • N
            necromonger last edited by

            Läuft alles in einer VM mit Debian 10. Mit welchem User muss ich mich denn anmelden?

            Thomas Braun 1 Reply Last reply Reply Quote 0
            • Thomas Braun
              Thomas Braun Most Active @necromonger last edited by Thomas Braun

              @necromonger Mit dem 'ersten' user (userid 1000). Der bekommt bei der Installation sudo-Rechte und administriert dann das System mittels 'sudo wasauchimmerrootrechtebenötigt'. Jedenfalls, wenn man das System richtig aufgesetzt hat.

              1 Reply Last reply Reply Quote 0
              • N
                necromonger last edited by necromonger

                @Thomas-Braun said in Radar2 läßt sich nicht mit root rechten ausführen:

                arp-scan

                Hier schein das Problem zu liegen. Also wenn ich die Befehle mit meinem User ausführe bekomme ich folgende Fehlermeldung:

                sudo setcap cap_net_admin,cap_net_raw,cap_net_bind_service=+eip $(eval readlink -f `which arp-scan`)
                
                readlink: missing operand
                Try 'readlink --help' for more information.
                usage: setcap [-q] [-v] (-r|-|<caps>) <filename> [ ... (-r|-|<capsN>) <filenameN> ]
                 Note <filename> must be a regular (non-symlink) file.]
                

                Also userid 1000 besitzt der User!

                Gruss
                David

                Thomas Braun 1 Reply Last reply Reply Quote 0
                • Thomas Braun
                  Thomas Braun Most Active @necromonger last edited by

                  @necromonger

                  groups
                  

                  Und bitte die komplette Ein- und Ausgabe zeigen. Inkl. login prompt.
                  Also so ungefähr:

                  pi@raspberrypi:~ $ groups
                  pi adm dialout cdrom sudo audio video plugdev games users input netdev gpio i2c spi iobroker
                  
                  1 Reply Last reply Reply Quote 0
                  • N
                    necromonger last edited by necromonger

                    @Thomas-Braun said in Radar2 läßt sich nicht mit root rechten ausführen:

                    groups

                    codiergott@iobroker-vm:/$ sudo -u iobroker groups
                    iobroker tty dialout audio video
                    codiergott@iobroker-vm:/$ whoami
                    codiergott
                    codiergott@iobroker-vm:/$ sudo whoami
                    root
                    codiergott@iobroker-vm:/$ groups
                    codiergott dialout cdrom floppy sudo audio dip video plugdev netdev iobroker
                    codiergott@iobroker-vm:/$
                    

                    Hatte IOBroker schon einmal auf einen Pi zu laufen und dort lief es ohne Probleme. Dort ging auch das setzen der Capabitilities.

                    Thomas Braun 2 Replies Last reply Reply Quote 0
                    • Thomas Braun
                      Thomas Braun Most Active @necromonger last edited by

                      @necromonger
                      Also bei meinem System funktioniert das:

                      pi@raspberrypi:~ $ sudo setcap cap_net_admin,cap_net_raw,cap_net_bind_service=+eip $(eval readlink -f `which arp-scan`)
                      pi@raspberrypi:~ $
                      
                      1 Reply Last reply Reply Quote 0
                      • N
                        necromonger last edited by necromonger

                        Auf meinem Pi ging das auch. Nur auf einer frischen Debian 10 installation geht es irgendwie nicht. Hab Debian 10 neu aufgesetzt und dann probiert. Das gleiche.
                        Mit getcap bekomme ich folgende Ausgabe:

                        codiergott@iobroker-vm:/$ sudo which arp-scan
                        /usr/sbin/arp-scan
                        codiergott@iobroker-vm:/$ sudo getcap /usr/sbin/arp-scan
                        /usr/sbin/arp-scan = cap_net_bind_service,cap_net_admin,cap_net_raw+eip
                        

                        Das sieht für mich korrekt aus!

                        Thomas Braun 1 Reply Last reply Reply Quote 0
                        • Thomas Braun
                          Thomas Braun Most Active @necromonger last edited by

                          @necromonger

                          which arp-scan
                          

                          und dann ersetzt du das im setcap entsprechend:

                          pi@raspberrypi:~ $ which arp-scan
                          /usr/sbin/arp-scan
                          pi@raspberrypi:~ $ sudo setcap cap_net_admin,cap_net_raw,cap_net_bind_service=+eip $(eval readlink -f /usr/sbin/arp-scan)
                          
                          S 1 Reply Last reply Reply Quote 0
                          • Thomas Braun
                            Thomas Braun Most Active @necromonger last edited by

                            @necromonger
                            Kann auch sein, dass die 'Netzwerkkarte' in der VM nicht mit arp-scan umgehen kann. Das ganze ist recht hardwarenah, wenn ich mich recht entsinne.

                            1 Reply Last reply Reply Quote 0
                            • N
                              necromonger last edited by

                              Das funktioniert reibungslos. Bei /etc/sudoers ist folgende Zeile als Kommentar markiert:

                              #includedir /etc/sudoers.d
                              

                              Die Zeile fügt doch alle Dateiinhalt aus /etc/sudoers.d der Datei hinzu. Also auch die Konfig von IOBroker.

                              Thomas Braun 1 Reply Last reply Reply Quote 0
                              • Thomas Braun
                                Thomas Braun Most Active @necromonger last edited by Thomas Braun

                                @necromonger Die Zeile tut gar nix, die ist auskommentiert. Und fummel da nix rum.

                                1 Reply Last reply Reply Quote 0
                                • N
                                  necromonger last edited by

                                  Das ist korrekt. Ich habe aber unter /etc/sudoers.d eine Datei zu liegen mit folgenden Name: iobroker

                                  Diese hat folgenden Inhalt:

                                  iobroker ALL=(ALL) ALL
                                  iobroker ALL=(ALL) NOPASSWD: /usr/sbin/shutdown
                                  iobroker ALL=(ALL) NOPASSWD: /usr/sbin/halt
                                  iobroker ALL=(ALL) NOPASSWD: /usr/sbin/poweroff
                                  iobroker ALL=(ALL) NOPASSWD: /usr/sbin/reboot
                                  iobroker ALL=(ALL) NOPASSWD: /usr/bin/systemctl start
                                  iobroker ALL=(ALL) NOPASSWD: /usr/bin/systemctl stop
                                  iobroker ALL=(ALL) NOPASSWD: /usr/bin/mount
                                  iobroker ALL=(ALL) NOPASSWD: /usr/bin/umount
                                  iobroker ALL=(ALL) NOPASSWD: /usr/bin/systemd-run
                                  iobroker ALL=(ALL) NOPASSWD: /usr/bin/apt-get
                                  iobroker ALL=(ALL) NOPASSWD: /usr/bin/apt
                                  iobroker ALL=(ALL) NOPASSWD: /usr/bin/dpkg
                                  iobroker ALL=(ALL) NOPASSWD: /usr/bin/make
                                  iobroker ALL=(ALL) NOPASSWD: /usr/bin/ping
                                  iobroker ALL=(ALL) NOPASSWD: /usr/sbin/setcap
                                  iobroker ALL=(ALL) NOPASSWD: /usr/bin/cat
                                  iobroker ALL=(ALL) NOPASSWD: /usr/bin/df
                                  iobroker ALL=(ALL) NOPASSWD: /usr/sbin/ldconfig
                                  ALL ALL=NOPASSWD: /usr/bin/systemctl start iobroker
                                  ALL ALL=NOPASSWD: /usr/bin/systemctl stop iobroker
                                  ALL ALL=NOPASSWD: /usr/bin/systemctl restart iobroker
                                  ALL ALL=(iobroker) NOPASSWD: /usr/bin/node /opt/iobroker/node_modules/iobroker.js-controller/iobroker.js *
                                  

                                  Dies wird dann nicht in die sudoers Datei eingefügt.

                                  Thomas Braun 1 Reply Last reply Reply Quote 0
                                  • Thomas Braun
                                    Thomas Braun Most Active @necromonger last edited by Thomas Braun

                                    @necromonger Doch, das ist richtig so wie es ist.

                                    which setcap
                                    

                                    Kannst auch mal den

                                    iobroker fix
                                    

                                    durchjagen.

                                    1 Reply Last reply Reply Quote 0
                                    • N
                                      necromonger last edited by

                                      which setcap

                                      /usr/sbin/setcap
                                      

                                      iobroker fix durchgejagt und neugestartet. Gleicher Fehler!

                                      1 Reply Last reply Reply Quote 0
                                      • N
                                        necromonger last edited by necromonger

                                        @Thomas-Braun said in Radar2 läßt sich nicht mit root rechten ausführen:

                                        sudo setcap cap_net_admin,cap_net_raw,cap_net_bind_service=+eip $(eval readlink -f which l2ping)

                                        Fehler gefunden:

                                        sudo setcap cap_net_admin,cap_net_raw,cap_net_bind_service=+eip $(eval readlink -f /usr/sbin/arp)
                                        

                                        Kommandozeile hat bei der Installation irgendwie nicht funktioniert!

                                        Jetzt läuft alles!!

                                        Danke dir für deine Hilfe!

                                        Thomas Braun 1 Reply Last reply Reply Quote 0
                                        • Thomas Braun
                                          Thomas Braun Most Active @necromonger last edited by Thomas Braun

                                          @necromonger sagte in Radar2 läßt sich nicht mit root rechten ausführen:

                                          sudo setcap cap_net_admin,cap_net_raw,cap_net_bind_service=+eip $(eval readlink -f which l2ping)

                                          Das ist ja auch falsch. Da fehlen die Hochkommata um which l2ping
                                          Hatte ich aber auch so nicht geschrieben.

                                          1 Reply Last reply Reply Quote 0
                                          • S
                                            steimi @Thomas Braun last edited by

                                            @thomas-braun ich habe (vermutlich nach dem Update auf Debian 12) das selbe Problem.

                                            bei dem Befehl "which arp-scan" und "arp" kommt unter dem User iobroker immer die Meldung

                                            iobroker@iobroker:~$ arp-scan
                                            -bash: arp-scan: Kommando nicht gefunden.
                                            

                                            somit laufen auch die beiden setcap-Befehle für arp & arp-scan auf Fehler.

                                            
                                            iobroker@iobroker:~$ sudo setcap cap_net_admin,cap_net_raw,cap_net_bind_service=+eip $(eval readlink -f `which arp-scan`)
                                            readlink: fehlender Operand
                                            „readlink --help“ liefert weitere Informationen.
                                            usage: setcap [-h] [-q] [-v] [-n <rootid>] (-r|-|<caps>) <filename> [ ... (-r|-|<capsN>) <filenameN> ]
                                            
                                             Note <filename> must be a regular (non-symlink) file.
                                             -r          remove capability from file
                                             -           read capability text from stdin
                                             <capsN>     cap_from_text(3) formatted file capability
                                             [ Note: capsh --suggest="something..." might help you pick. ]
                                             -h          this message and exit status 0
                                             -q          quietly
                                             -v          validate supplied capability matches file
                                             -n <rootid> write a user namespace (!= 0) limited capability
                                             --license   display the license info
                                            iobroker@iobroker:~$
                                            
                                            

                                            Im Log für Radar2 kommt dann

                                            Adapter not running as root or iobroker has no sudo right, cannot use arp-scan!
                                            

                                            Gruppenzugehörigkeit ist folgende:

                                            iobroker@iobroker:~$ sudo -u iobroker groups
                                            iobroker tty dialout cdrom floppy sudo audio dip video plugdev netdev bluetooth
                                            

                                            was kann/muss ich tun?

                                            System ist aktuell, js-controller 5.0.12/node 18.17.1

                                            Thomas Braun 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            432
                                            Online

                                            31.9k
                                            Users

                                            80.1k
                                            Topics

                                            1.3m
                                            Posts

                                            4
                                            31
                                            1928
                                            Loading More Posts
                                            • Oldest to Newest
                                            • Newest to Oldest
                                            • Most Votes
                                            Reply
                                            • Reply as topic
                                            Log in to reply
                                            Community
                                            Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                                            The ioBroker Community 2014-2023
                                            logo