Basic Linux Commands: The ssh Command

Basic Linux Commands: The ssh Command
Page content

Basic usage

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.

Final Thoughts

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

Linux is well known for its security. It’s one of the many reasons why IT managers insist on using Linux to keep data safe. But do you know the tools to keep your Linux boxes security as high as possible? This Bright Linux Commands series will introduce you to the tools you need to keep Linux secure

  1. Know your Linux security tools
  2. Linux Command Line: ssh
  3. Linux Command Line: gpg
  4. Let IPtables Help Secure Your Linux Box
  5. Linux Firewalls Made Easy With Fwbuilder