Monday, 19 December 2011

execute commands remotely using ssh

I want to write to a file into /tmp/text.dat  file of another machine with out logging into that machine.
This is how , we can do:

echo "hello world"  |  ssh root@remotehost 'cat >/tmp/text.dat'  will write  "hello world"  to  text.dat file of remotehost.Ofcourse, ssh will ask you for password of the remote machine for authentication.

SSH can also be used to tunnel TCP traffic between the SSH server and client.

ssh -L 8080:remote-host:80 user@ssh-server 

This way , http://localhost:8080/ will access the webpage on remote-host:80

No comments:

Post a Comment

Tweets by @sriramperumalla