How to SSH on Ubuntu – A Simple Guide

Lots has been written about SSH on Linux machines, but all too often it is written in technical jargon that confuses what is actually a very simple and infinitely useful technology. Here is a idiots guide to getting started with SSH in 2 minutes.

What is SSH and why should I know about it?

SSH stands for Secure SHell and gives a robust and secure way to control another computer (including servers) remotely.

You know how you can control your Linux box through the terminal command line? Well, if you have SSH set up, you can also control a remote computer over the network. This is really useful for taking control of things like webservers. If you use a host like Bluehost(Please note this is an affiliate link, but it is the hosting company I use and I recommend them totally) you can get a fixed IP address and SSH access which allows you to take control of the server using the command line.

To successfully have a SSH connection, you need an SSH Client and a SSH Server that speak to each other.

The SSH Client

The SSH Client is the piece of software that you have on the computer you are sitting in front of and typing on. It sends messages to the SSH server which is on the remote computer (such as the webserver). We’ll assume that there is already a valid SSH server up and running that you are trying to connect to.

In Ubuntu, there is a SSH client installed as standard and it is called Open SSH.

To use it, you simply open a terminal and proceed any command with “ssh”.

For example, if you would like to log in to your remote server, just use the command…


However, as this is a blog that likes to keep things simple (and annoy a lot of the die-hard Linux geeks), I’m going to suggest a different tool… PuTTY.

PuTTY is a client program for SSH (among other things) and gives a neat little interface for making SSH connections. It is also in my opinion one of the best pieces of software ever written. It has been around for ever and can also be used on Windows without installation (just runs as a .exe). Learn this little guy and you will never look for another SSH client.

Install PuTTY by typing the following into a terminal…

sudo apt-get install putty

You will then find the PuTTY program among your other internet applications.

(When you start it up, you will be able to enter the ip address or name of the remote computer you wish to contact and click connect. You will then be asked for password etc. If you are going to be using SSH regular, you can save that connection as a profile which makes things easier).

The SSH Server

We’ve assumed up to now that you already have a SSH server to connect to. If this is not the case, then we need to install a SSH server on what will be the remote computer. (If you are using Bluehost, just speak to their support guys and they will do this for you).

If you have access to the computer that will be the remote computer, just open up a terminal and type…

sudo apt-get install openssh-server

That wasn’t too difficult now was it?

A couple of tests and a Security improvement

Let’s test that everything is up and running.

On the remote computer, start up PuTTY as mentioned above. Put in the local IP address of your machine (nearly allways as shown below and click “Open”.

You will get a warning box talking about Keys and Certiicates, but just be like an iPad user and click accept to everything that pop-s up ;)

You now need to log in using your username and then your password for the remote machine.

That should be you logged in over SSH!!!

(You can now go off and see if you can use a different computer to log in to this system , remember that you will then need to use the external IP address of the remote computer when logging in via PuTTY).

A good way to test using your SSH connection is to make a little security update. The default port for SSH is 22 and some bad boys out there try and force their way in via this port. Let’s open the SSH config file and change that port to something else.

Via your PuTTY session, type in…

sudo vi /etc/ssh/sshd_config

This lets you edit the config file directly through the terminal. Use the arrow keys to find the line that shows the “Port 22″, press Shift+i on the keyboard and this lets you edit the file. change the port to whatever port you want, for example 3901. Press Ctrl+x and then :x to save the file and exit.

You then need to restart the SSH server to change the port. Again in PuTTY type…

sudo /etc/init.d/ssh restart

Next time you log into the SSH, via PuTTY you will need to change the SSH Port to the new one you set (i.e 3901).

There are lots of other security improvements you can make in this config file. If you know one, why not put it in the comments box below? (If you don’t know one, why not Like this article on Facebook and maybe your friends will know one ;) )

original link:


About zephyr9000

Happy sailer
This entry was posted in ssh and tagged . Bookmark the permalink.

One Response to How to SSH on Ubuntu – A Simple Guide

  1. thank a lot share
    Ubuntu – A Simple Guide

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s