The most common use of ssh is to securely log into a remote machine like so:
ssh -v -l REMOTE_USERNAME REMOTE_ADDRESS
Where REMOTE_USERNAME is the username on the remote machine you want to log with, and REMOTE_ADDRESS is the URL or the IP address of the remote machine.
What you will have, once you have entered the correct username and password is that username's bash prompt. You can issue commands but you cannot start any application that requires a graphical interface. You can do what is called "tunneling" which will allow you to tunnel X Windows from one machine to another. What this does is allows you to run graphical applications that are on a remote machine, on a local machine. For instance: Remote machine 192.168.1.10 has installed Scribus, whereas local machine 192.168.1.20 has not. You have a user account on both machines but you do not have physical access to the remote machine. To use Scribus on the local machine you would need to log onto the remote machine using the -X argument to allow the machines to tunnel X applications. This new command looks like:
ssh -v -l USERNAME 192.168.1.10 -X
Where USERNAME is the actual user name to login with.
Of course it should be noted that in order to log into the remote machine, the remote machine must be running the secure shell daemon.
In the above command, besides the -X argument (which has already been explained), there are two arguments used. These arguments are:
- v – This shows verbose output, so you know exactly what is happening as secure shell makes the connection.
- l – This is the login argument which is always proceeded by the actual login name on the remote machine.
What you have seen is the very basics of using secure shell, which will allow you to handle the most widely used tasks this application offers. With the ability to log into a remote server and run X applications, secure shell offers you enough tools to do remote administration.
This post is part of the series: Keep your Linux box secure with these tools
- Know your Linux security tools
- Linux Command Line: ssh
- Linux Command Line: gpg
- Let IPtables Help Secure Your Linux Box
- Linux Firewalls Made Easy With Fwbuilder