Script per Sudo remote ausführen
Hallo,
ich möchte, dass von lokal über SSH ein Script remote ausgeführt wird, welches sich lokal befindet.
Normalerweise geht das ja mit:
Nur wie mache ich das, wenn Script.sh remote Root rechte braucht ? bspw. über sudo ... Sudo benötigt auf dem Remote kein Passwort!
ich möchte, dass von lokal über SSH ein Script remote ausgeführt wird, welches sich lokal befindet.
Normalerweise geht das ja mit:
ssh login@remote_host 'bash -s' < Script.sh
Please also mark the comments that contributed to the solution of the article
Content-Key: 252034
Url: https://administrator.de/contentid/252034
Printed on: April 19, 2024 at 17:04 o'clock
3 Comments
Latest comment
Hi, das kommt darauf an, ob der der Account sudo-Rechte auf der Maschine hat. Kannst du in /etc/sudoers prüfen bzw. wenn nicht einfügen.
ssh root@host -t 'sed -i "\$a text to insert" /path/to/file'
Ansonsten sollte es mit der Option -t funktionieren.. $ ssh user@host -t 'bash -s' < Script.sh
Alternativ schau dir mal das an: http://code.google.com/p/sshsudo/
ssh root@host -t 'sed -i "\$a text to insert" /path/to/file'
Ansonsten sollte es mit der Option -t funktionieren.. $ ssh user@host -t 'bash -s' < Script.sh
Alternativ schau dir mal das an: http://code.google.com/p/sshsudo/