Re: Send commands to ssh



Horacius ReX <horacius.rex@xxxxxxxxx> wrote:


Florian Diesch wrote:
Horacius ReX <horacius.rex@xxxxxxxxx> wrote:

So I wonder how is it possible to send commands to ssh. For instance a
script.

ssh reads commands from STDIN (like normal shells do):

echo 'hostname; ls'|ssh some_host

Please don't top post.

this is just what i needed !

but in this case, can i also echo a script ?

Everything ssh reads from STDIN gets executed line by line on the remote
host.


Florian
--
<http://www.florian-diesch.de/>
-----------------------------------------------------------------------
** Hi! I'm a signature virus! Copy me into your signature, please! **
-----------------------------------------------------------------------
.



Relevant Pages

  • Re: Ssh and sftp via here document
    ... The file transfer is performed by sftp during an ssh session ... storing cleartext passwords in the script. ... Note that echo 3 and echo 4 do not appear; ... Everything works as I expect when I issue the ssh and sftp commands ...
    (comp.unix.shell)
  • SSH scripts hanging
    ... I have been having a a problem recently with a script set to SSH into ... We have been running one sensor on Redhat ... echo "Removing Log files from Sensor 3" ...
    (comp.security.ssh)
  • Re: Send commands to ssh
    ... can i also echo a script? ... ssh reads commands from STDIN: ...
    (comp.os.linux.misc)
  • gfb: help with ssh script
    ... I am trying to run a simple script that would log into the host specified in ... then run a few commands to collect the information. ... do echo $i ... It seems it initially echos each line in 'list', but then proceeds to ssh ...
    (SunManagers)
  • Re: [Full-disclosure] reduction of brute force login attempts via SSHthrough iptables --
    ... Anyhow its no problem at all to modify, so if you dont like it, just dont use it. ... on a lame script like this as long as it WORKS and is not insecure. ... echo "~ sorting out ip by ip" ... # echo "not enough failed logins, probably no attack from: ...
    (Full-Disclosure)