LowEndBox - Cheap VPS, Hosting and Dedicated Server Deals

How to setup SSH for Ubuntu or Windows

lowendtutorial

It’s been a while again, since I’ve posted a tutorial. I’ve been quite busy with a lot of things and have had a nice little vacation as well. But no worries, the tutorials are back on schedule and I’m planning to have one again every other week!

So, this tutorial is one for absolute beginners. I’ve done a tutorial once on setting up an SSH key pair and many people said: why not explain SSH first? Well, this tutorial is just that. If you’ve just purchased a server or are planning to do so, but don’t know what to do after you purchased it: this tutorial is for just that!

I’m going to give a brief overview of SSH and then I’ll show you how to connect with Windows (using PuTTY) and Ubuntu (using it’s default Terminal). This should get you into your server. What do to once actually on the server, is something I’m going to discuss another time.

About SSH

SSH is a network protocol and stands for ‘Secure Shell’. It is what is says it is: a means to securely access a shell account. A shell account is a user account on a remote server. So you may say it’s a way to securely log in to a remote server. SSH is usually used to execute commands on the remove server. There’s more uses for the protocol as well, besides logging in to a remote user account. For example: transferring files using SFTP or SCP, creating a simple tunnel, and other things.

SSH has been around since 1995 and has two versions: SSH-1 and SSH-2. Almost every server around these days uses SSH-2. SSH-1 is open to quite some vulnerabilities because of design flaws, which is the primary reason it’s not being used anymore. SSH is still under development, but no major or ground-breaking new features have been added for a while. The focus is on security and stability, as it should be.

Setting UP SSH Windows

Connecting to a server over SSH on Windows requires PuTTY. PuTTY is a free, small, stand-alone application that lets you connect to servers over SSH on Windows. Windows doesn’t come with SSH itself, so you really need a third party application for that. PuTTY can be downloaded here: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html. You just need ‘putty.exe’. Download it and put it somewhere to your liking. It doesn’t require anything else, so just launch it after downloading it. This should show PuTTY’s default screen:

2014-01-20 06_10_56-PuTTY Configuration

In the ‘Host Name’ field, input the hostname or IP address of your server. I’ve chosen to use the IP address here. Now hit the ‘Open’ button. You should get a prompt titled ‘PuTTY Security Alert’. No worries, this is completely normal.

2014-01-20 06_11_15-PuTTY Security Alert

This prompt asks you whether you trust the host. It shows the host’s RSA fingerprint. SSH uses this fingerprint while connecting to see if the server is actually the same as it was before. In order to be able to do this, it needs to have the fingerprint first. So it prompts you whether you trust this host the first time you connect so it. If you say “Yes”, PuTTY will save the fingerprint in the so-called known_hosts file and use that to compare with the host’s RSA fingerprint on future connection attempts. If the host’s RSA fingerprint doesn’t match the known one, the host either got reinstalled or the host is not the one you think it is (possible indicating an attack). So, a quite useful mechanism altogether. Accepting your host’s RSA fingerprint should move you on to the next screen, the actual terminal:

2014-01-20 06_11_31-192.30.34.228 - PuTTY

Here it asks you for your username and your password. In this case, I’ve used ‘root’ as the username. Type in your password and hit enter, this should give you a window like this (on Ubuntu hosts):

2014-01-20 06_13_31-root@alpha_ ~

You have succesfully logged in to your server over SSH! Congratulations! That’s how simple it was.

From here on, you’re on your own from now on. You can use commands like ‘cd’ and ‘ls’ to move around a bit and explore your system, but more on that in a future tutorial!

Setting UP SSH Ubuntu

Connecting to a server over SSH on Ubuntu is somewhat easier. It doesn’t require a download. Instead, Ubuntu comes with an application named ‘Terminal’ and Ubuntu ships with an SSH client already installed. Open up the ‘Terminal’ application. You should see a window like this:

Terminal_001

In the above window, I have already attempted to connect to a server. I did this by typing:

ssh root@192.30.34.228

In the terminal windows and hitting ‘Enter’. With this command, you start the SSH client application and tell it to connect to the server at 192.30.34.228 as user ‘root’. You should replace that IP with the IP address of your server.

It then asks you whether you trust the host. It shows the host’s RSA fingerprint. SSH uses this fingerprint while connecting to see if the server is actually the same as it was before. In order to be able to do this, it needs to have the fingerprint first. So it prompts you whether you trust this host the first time you connect so it. If you type “yes”, SSH will save the fingerprint in the so-called known_hosts file and use that to compare with the host’s RSA fingerprint on future connection attempts. If the host’s RSA fingerprint doesn’t match the known one, the host either got reinstalled or the host is not the one you think it is (possible indicating an attack). So, a quite useful mechanism altogether. Accepting your host’s RSA fingerprint should trigger the host to ask for your password:

Terminal_002

Type in your password and hit enter, this should give you a window like this (on Ubuntu hosts):

rootalpha003

You have succesfully logged in to your server over SSH! Congratulations! That’s how simple it was.

From here on, you’re on your own from now on. You can use commands like ‘cd’ and ‘ls’ to move around a bit and explore your system, but more on that in a future tutorial!

Final note about the basics of SSH for Ubuntu and Windows

While this is only a very basic tutorial, it should show absolute beginners how to (and how easy it is to) connect to a VPS. In a next tutorial, I want to dive into some basic commands. I’m sure I can’t cook them all up myself, so if you know any commands I should really explain, let me know in the comments! This tutorial, combined with the follow-up, should be enough to get absolute beginners started on a VPS.

Up next time: Observing devices with Observium

mpkossen

14 Comments

  1. Most of us hanging out here already know this. But again there are always some beginners learning new things and this might be quite useful to them.

    February 22, 2014 @ 8:12 am | Reply
  2. Mr Satan:

    thanks for the tutorial. :)

    February 22, 2014 @ 9:11 am | Reply
  3. Hybrid:

    I’d recommend SSH Secure Shell Client. It has the command line and SFTP. It’s much better than putty in my opinion :)

    February 22, 2014 @ 9:26 am | Reply
  4. perennate:

    I don’t think anyone still uses Winows or whatever it’s called.

    February 22, 2014 @ 10:37 am | Reply
  5. I prefer XShell…

    February 22, 2014 @ 10:40 am | Reply
    • Mark:

      +1 for XShell.

      Free for non-commercial use, saves passwords if you want, tabbed sessions, SFTP client.

      February 22, 2014 @ 4:45 pm | Reply
      • perennate:

        +1 for OpenBSD Secure Shell

        February 22, 2014 @ 5:06 pm | Reply
    • Maarten Kossen:

      Don’t know that one. I’m checking it out right now.

      February 23, 2014 @ 2:37 am | Reply
  6. Mitz:

    Thank for the tutorial!

    February 22, 2014 @ 10:24 pm | Reply
  7. tank:

    in windows, i usually using bitvise tunnelier :D

    February 22, 2014 @ 11:22 pm | Reply
  8. mrjoeyman:

    I am brand new trying to use a vps to set up a vpn to watch my netflix. This was helpful to me, thanks. Are there anymore tutorials laying around?

    February 23, 2014 @ 8:46 pm | Reply
  9. can you explain me how to config ssh for tunneling as proxy ?

    September 24, 2014 @ 11:02 am | Reply
  10. mdtve:

    Thanks for your time with this tutorials it shines some light into the world of vps

    December 6, 2015 @ 12:14 pm | Reply

Leave a Reply

Some notes on commenting on LowEndBox:

  • Do not use LowEndBox for support issues. Go to your hosting provider and issue a ticket there. Coming here saying "my VPS is down, what do I do?!" will only have your comments removed.
  • Akismet is used for spam detection. Some comments may be held temporarily for manual approval.
  • Use <pre>...</pre> to quote the output from your terminal/console, or consider using a pastebin service.

Your email address will not be published. Required fields are marked *