ssh command can by used to remotely login to a server running sshd daemon. This allows linux administrators to perform variety of administrative jobs. However, ssh is more powerful than just providing a user with remove shell access, it can also be used to automate remote command executions, running simple backups and download the backup file locally. Here are couple examples:
The following ssh command can be used to to create a file remotely:

ssh This email address is being protected from spambots. You need JavaScript enabled to view it. '( cd /tmp/ && touch ssh_file.txt )'

Make a local copy of a remote /etc/passwd file to /tmp/passwd:

ssh This email address is being protected from spambots. You need JavaScript enabled to view it. '( cat /etc/passwd )' > /tmp/passwd

Execute a script on the remote server with ssh:

NOTE: we assume that the script exists, is executable and you have executable permissions

ssh This email address is being protected from spambots. You need JavaScript enabled to view it. '( cat ~/myscript.sh )' 

In this example we make a bzip2 local copy of /var/log/auth.log file to a local /tmp/ direcotry:

ssh This email address is being protected from spambots. You need JavaScript enabled to view it. '( cp /var/log/auth.log /tmp/; cd /tmp/ && tar -jcvf - auth.log )' > /tmp/auth.tar.bz2


Free Linux eBooks

Do you have the right skills?

Our IT Skills Watch page reflects an up to date IT skills demand leaning towards the Linux and Unix environment. We have considered a number of skills and operating systems.

See the result...

Linux Online Training

Learn to run Linux servers and prepare for LPI certification with Linux Academy. 104 available video lessons with PDF course notes with your own server!

Go to top