Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. Probleme mit Exec

    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

    Probleme mit Exec

    This topic has been deleted. Only users with topic management privileges can see it.
    • K
      Kuddel @AlCalzone last edited by

      @AlCalzone ich habe auf dem zielsystem den public ssh key hintelegt, so dass keine pw abfrage kommt.

      es kann sein, dass auf dem alt system der User ioBroker existiert und auf dem neuen nicht

      AlCalzone 1 Reply Last reply Reply Quote 0
      • AlCalzone
        AlCalzone Developer @Kuddel last edited by

        @Kuddel Dann probier es doch mal von Hand (als ioBroker)

        sudo su - iobroker -s /bin/bash
        ssh root@192.168.4.5 uptime | awk '{print $3_$4_$5}'
        

        dann sehen wir vllt wo es hakt.

        K 1 Reply Last reply Reply Quote 0
        • K
          Kuddel @AlCalzone last edited by Kuddel

          @AlCalzone sagte in Probleme mit Exec:

          sudo su - iobroker -s /bin/bash

          root@ioBroker-MASTER:~# sudo su - iobroker -s /bin/bash
          iobroker@ioBroker-MASTER:~$ ssh root@192.168.4.5 uptime | awk '{print $3_$4_$5}'
          root@192.168.4.5's password:
          120days,4:10,
          

          Der User ioBroker hat keinen Zugriff auf den SSH Key

          root@ioBroker-MASTER:/home/iobroker# sudo su - iobroker -s /bin/bash
          iobroker@ioBroker-MASTER:~$ cd /root/.ssh
          -su: cd: /root/.ssh: Permission denied
          iobroker@ioBroker-MASTER:~$
          
          
          root@ioBroker-MASTER:~/.ssh# ls -l
          total 12
          -rw------- 1 root root    0 Sep 27 08:50 authorized_keys
          -rw------- 1 root root 1679 Nov 20 08:40 id_rsa
          -rw-r--r-- 1 root root  402 Nov 20 08:40 id_rsa.pub
          -rw-r--r-- 1 root root 2658 Nov 20 08:49 known_hosts
          root@ioBroker-MASTER:~/.ssh#
          
          

          Wir kann ich dem user die Rechte geben ?

          H 1 Reply Last reply Reply Quote 0
          • H
            HeliosFan @Kuddel last edited by

            @Kuddel

            wie wärs mit "chown" ?

            K 1 Reply Last reply Reply Quote 0
            • K
              Kuddel @HeliosFan last edited by

              @HeliosFan sagte in Probleme mit Exec:

              @Kuddel

              wie wärs mit "chown" ?

              iobroker@ioBroker-MASTER:/root/.ssh$ chown iobroker id_rsa
              chown: changing ownership of 'id_rsa': Operation not permitted
              
              
              AlCalzone 1 Reply Last reply Reply Quote 0
              • AlCalzone
                AlCalzone Developer @Kuddel last edited by AlCalzone

                @HeliosFan nein! Die Datei gehört root und das muss auch so bleiben.

                @Kuddel
                Du musst die gleiche SSH-ID im Kontext von iobroker anlegen, d.h. /home/iobroker/.ssh. Wie ich schon schrieb:

                [...] muss das Zertifikat für den User iobroker (der den ssh-Befehl ausführt) auffindbar und lesbar sein.

                Was auch immer du gemacht hast, um root zu authentifizieren, das gleiche musst du für iobroker machen, wenn du dich mit obigem Befehl als dieser "angemeldet" hast. Wenn du das kurz beschreiben könntest, wäre super - dann können wir das ein für alle mal dokumentieren.

                H 1 Reply Last reply Reply Quote 0
                • H
                  HeliosFan @AlCalzone last edited by

                  @AlCalzone

                  dann könnte er doch einfach einen Move machen

                  AlCalzone 1 Reply Last reply Reply Quote 0
                  • AlCalzone
                    AlCalzone Developer @HeliosFan last edited by

                    @HeliosFan Und dann kann root sich nicht mehr anmelden. Und evtl auch nicht auf anderen Hosts, für die er noch Schlüssel hat.

                    1 Reply Last reply Reply Quote 0
                    • K
                      Kuddel last edited by Kuddel

                      Jetzt funktioniert es...

                      Ich habe die datei "id_rsa" mit dem SSH Key, der auf allen Systemen hintelegt ist nach /home/iobroker/.ssh kopiert und per chmod die berechtigungen geändert.

                      Wenn jetzt z.b. meinen DVB-C Receiver abfrage

                      iobroker@ioBroker-MASTER:~/.ssh$ ssh root@192.168.4.24 uptime | awk '{print $3_$4_$5}'
                      The authenticity of host '192.168.4.24 (192.168.4.24)' can't be established.
                      RSA key fingerprint is SHA256:MkOXmCMvJYSQrnxHcpTyVVaiVHSdkVXQ6M/S0QqJLWE.
                      Are you sure you want to continue connecting (yes/no)? yes
                      Warning: Permanently added '192.168.4.24' (RSA) to the list of known hosts.
                      18days,16:31,
                      

                      bekomme ich ein Ergebnis 🙂

                      1 Reply Last reply Reply Quote 1
                      • U
                        UncleB last edited by UncleB

                        Ich habe wohl grad gleiches Problem..
                        ioBroker läuft im Docker, würde gerne über ein Blockly Script meinen Linux Rechner in den Standby schicken..
                        Aus der Docker Konsole klappt das auch wunderbar,
                        ssh root@192.168.54.143 /usr/sbin/pm-suspend
                        Linux Rechner geht in den Standby..
                        Nur im Blockly als exec passiert nichts, exec ist im Adapter erlaubt...

                        Vermutlich gleiches Problem? iobroker logt sich als iobroker ein und nicht als root?
                        Aufjedenfall bekomm ichs nicht hin das sich iobroker ohne PW authentifizieren kann..
                        Hab auf meinen Linux System schon einen Benutzer "iobroker" angelegt, in /home/iobroker/.ssh/authorized_keys den Pub Key geklatscht...
                        Bei einem Test Login aus der Docker Konsole ssh iobroker@192.168.54.143 wird jedesmal ein PW abgefragt, ich verstehe nicht wieso..
                        Hat da noch jemand ne Idee??

                        AlCalzone 1 Reply Last reply Reply Quote 0
                        • AlCalzone
                          AlCalzone Developer @UncleB last edited by

                          @UncleB Das Problem ist andersherum. Du benötigst keinen User iobroker auf dem Zielrechner. Der User iobroker auf dem aktuellen Host benötigt die Zertifikate/whatever für root auf dem Zielhost.

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

                          Support us

                          ioBroker
                          Community Adapters
                          Donate

                          427
                          Online

                          31.9k
                          Users

                          80.1k
                          Topics

                          1.3m
                          Posts

                          4
                          13
                          920
                          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