Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. Terminal Befehl an anderen Pi senden

    NEWS

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

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    Terminal Befehl an anderen Pi senden

    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      danny_v1 last edited by

      Hallo ich versuche gerade einen Terminal Befehl an einen anderen Raspberry auf dem Hyperion läuft zu senden, leider bislang ohne Erfolg. Und im Netz hab ich auch nicht das gefunden was ich suche.

      Der Befehl den ich normalerweise über Putty in die Konsole eingebe wäre z.B:

      "v4l2-ctl --set-ctrl brightness=512"

      Das ganze soll über einen Button ausgelöst werden und die 512 aus dem Beispiel kommt aus einer Variablen.

      Das hab ich bis jetzt:

      Bild_2020-11-02_103348.png

      Ich hoffe mir kann jemand auf die Sprünge helfen!

      Asgothian 1 Reply Last reply Reply Quote 0
      • Asgothian
        Asgothian Developer @danny_v1 last edited by

        @danny_v1

        • Was passiert den ?
        • Gibt es einträge im Log ?
        • Darf der JS Adapter exec ausführen ?
        • Lass dir mal den Befehl den du an das exec gibst als Debug ausgeben, und dann versuch diesen Befehl auf der Konsole deines ioBroker auszuführen, um Dir die Fehlermeldungen anzuschauen.
        D 1 Reply Last reply Reply Quote 0
        • D
          danny_v1 @Asgothian last edited by

          @Asgothian über die Konsole meines iobroker geht es jetzt (lag wahrscheinlich am ECDSA key fingerprint) , aber er will immer das Passwort des Pi`s haben bei jedem Befehl.

          UncleSam AlCalzone 2 Replies Last reply Reply Quote 0
          • UncleSam
            UncleSam Developer @danny_v1 last edited by

            @danny_v1 sagte in Terminal Befehl an anderen Pi senden:

            aber er will immer das Passwort des Pi`s haben bei jedem Befehl

            Entweder du gibst das Passwort mit sshpass an, oder du verwendest SSH keys.

            D 1 Reply Last reply Reply Quote 0
            • D
              danny_v1 @UncleSam last edited by

              @UncleSam wie funktioniert das genau, hab das in den links leider nicht wirklich verstanden.

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

                @danny_v1 sagte in Terminal Befehl an anderen Pi senden:

                aber er will immer das Passwort des Pi`s haben bei jedem Befehl.

                Die Skripte laufen als User iobroker, welcher sich vermutlich nicht als pi auf dem anderen Host anmelden darf.

                Geh mal auf die Konsole und wechsel dort zum User iobroker:

                sudo -u iobroker -s /bin/bash
                

                Dort musst du dann den Login so konfigurieren, dass du dich mit SSH keys ohne Passwort (siehe Links von @UncleSam) verbinden kannst. Danach sollte es auch im Skript-Adapter funktionieren.

                D 1 Reply Last reply Reply Quote 0
                • D
                  danny_v1 @AlCalzone last edited by

                  @AlCalzone said in Terminal Befehl an anderen Pi senden:

                  sudo -u iobroker -s /bin/bash

                  wen ich das auf dem 2ten raspi eingebe da kommt "sudo: unknown user: iobroker"

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

                    @danny_v1 Ne auf dem ersten wo iobroker läuft!

                    D 1 Reply Last reply Reply Quote 0
                    • D
                      danny_v1 @AlCalzone last edited by

                      @AlCalzone ok da passiert erstmal gar nichts.

                      wenn ich danach wie im Link:
                      "echo password | ssh iobroker@raspberrypi" eingebe, kommt folgende Ausgabe:

                      "Pseudo-terminal will not be allocated because stdin is not a terminal.
                      iobroker@raspberrypi's password:
                      Permission denied, please try again."

                      AlCalzone Meister Mopper 2 Replies Last reply Reply Quote 0
                      • AlCalzone
                        AlCalzone Developer @danny_v1 last edited by

                        @danny_v1 Du sollst auch den Zugang per SSH-Key einrichten wie in dem Link von UncleSam beschrieben. Mit Passwort per stdin weiterleiten kommst du nicht weit.

                        D 1 Reply Last reply Reply Quote 0
                        • D
                          danny_v1 @AlCalzone last edited by

                          @AlCalzone

                          ok so weit bin ich bis jetzt gekommen:

                          "iobroker@raspberrypi:~ $ ssh-keygen
                          Generating public/private rsa key pair.
                          Enter file in which to save the key (/home/iobroker/.ssh/id_rsa):
                          /home/iobroker/.ssh/id_rsa already exists.
                          Overwrite (y/n)? y
                          Enter passphrase (empty for no passphrase):
                          Enter same passphrase again:
                          Your identification has been saved in /home/iobroker/.ssh/id_rsa.
                          Your public key has been saved in /home/iobroker/.ssh/id_rsa.pub.
                          The key fingerprint is:
                          SHA256:Zb0xQKC/OLoARQwx5NYOeEdY2sS3Yb2ruFZXl8/m9cM iobroker@raspberrypi
                          The key's randomart image is:
                          +---[RSA 2048]----+
                          |==.++ ..oo |
                          |oo+=. +.. o |
                          |.++.oo.o .o +. |
                          |.oo. ...o. o+ |
                          |. . So ..o |
                          | . ..o. + .|
                          | . ooo. o...|
                          | .o... .E.|
                          | .+o .|
                          +----[SHA256]-----+
                          iobroker@raspberrypi:~ $ ssh-copy-id userid@hostname
                          /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/iobroker/.ssh/id_rsa.pub"
                          /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed

                          /usr/bin/ssh-copy-id: ERROR: ssh: Could not resolve hostname hostname: Name or service not known

                          iobroker@raspberrypi:~ $ ssh-copy-id pi@HyperBian
                          /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/iobroker/.ssh/id_rsa.pub"
                          /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed

                          /usr/bin/ssh-copy-id: ERROR: ssh: Could not resolve hostname hyperbian: Name or service not known"

                          1 Reply Last reply Reply Quote 0
                          • Meister Mopper
                            Meister Mopper @danny_v1 last edited by

                            @danny_v1 mach es mal so:

                            ssh Schlüssel verteilen:
                            
                            auf dem ioBrokersystem:
                            sudo su - iobroker -s /bin/bash
                            cd ~/.ssh
                            ssh-keygen -t rsa
                            
                            3 x Enter
                               
                            auf dem Zielsystem:
                            pi@192.168.xxx.xxx> mkdir -p ~/.ssh
                            
                            auf dem ioBrokersystem:
                            iobroker@iobroker> cat ~/.ssh/id_rsa.pub | ssh pi@192.168.xxx.xxx 'cat >> .ssh/authorized_keys'
                            
                            noch einmalig das Passwort eingeben, danach ist es nicht mehr nötig
                            

                            D 1 Reply Last reply Reply Quote 0
                            • D
                              danny_v1 @Meister Mopper last edited by

                              @Meister-Mopper
                              auf dem Zielsystem:
                              pi@192.168.xxx.xxx> mkdir -p ~/.ssh

                              das ist die IP des iobrokers???

                              auf dem ioBrokersystem:
                              iobroker@iobroker> cat ~/.ssh/id_rsa.pub | ssh pi@192.168.xxx.xxx 'cat >> .ssh/authorized_keys'

                              Und das die IP des zweiten PIs?

                              Meister Mopper 1 Reply Last reply Reply Quote 0
                              • Meister Mopper
                                Meister Mopper @danny_v1 last edited by Meister Mopper

                                @danny_v1 Zielsystem ist das, auf welches das ioBroker-System senden soll. Also genau andersrum😊

                                D 1 Reply Last reply Reply Quote 0
                                • D
                                  danny_v1 @Meister Mopper last edited by

                                  @Meister-Mopper Super danke scheint zu funktionieren

                                  Meister Mopper 1 Reply Last reply Reply Quote 0
                                  • Meister Mopper
                                    Meister Mopper @danny_v1 last edited by

                                    @danny_v1 sagte in Terminal Befehl an anderen Pi senden:

                                    Super danke scheint zu funktionieren

                                    💪 👍

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

                                    Support us

                                    ioBroker
                                    Community Adapters
                                    Donate

                                    1.0k
                                    Online

                                    31.7k
                                    Users

                                    79.7k
                                    Topics

                                    1.3m
                                    Posts

                                    blockly communication
                                    5
                                    16
                                    1105
                                    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