HostOnNet Blog

HOWTO: log into your server using SSH

Looking for Linux Server Admin or WordPress Expert? We can help.

Are you a newbie trying to figure out how to remotely log into your server box securely for the first time? Well look no further, for what follows is a complete walk-through on how to properly log into your server and become root (superuser). This how-to applies only to the server owner/admin who has full superuser root access, not general site users.

The following directions apply only to those using the very popular and free PuTTY client software to log in securely into your server from your home, office, or your girlfriend’s apartment. You may learn about and download PuTTY for free at

http://www.chiark.greenend.org.uk/~sgtatham/putty/

This HOWTO was written for people accessing their server remotely from a Windows machine
and using only PuTTY as their SSH client software.

Prior to performing these directions, you must already know what your root password and also the main IP address of your server.

Open the PuTTY client (usually putty.exe). You will now see the “PuTTY Configuration” window.

On the left side, you will see a tree structure called “Category:”. There are four categories: Session, Terminal, Window, and Connection. Expand the “Connection” category and select “SSH”.

On the right side, look in the middle for “Preferred SSH protocol version:”. Select version “2”.

On the left side in the category tree structure, go back to “Session”.

On the right side, look for the “Host Name (or IP Address)” input box at the top. Enter your server’s main IP address only.

Under that input box you should see “Protocol:”. Select “SSH” and the little Port box will automatically change to port 22. Be sure you do this step.

Click “Open” at the bottom. Your secure SSH session will begin and if this truly is the very first time you are remotely logging into your server on any particular computer, you should get the following message pop into your face:

“The server’s host key is not cached in the registry. You have no guarantee that the server is the computer you think it is.

The server’s key fingerprint is:
blah blah blah

If you trust this host, hit Yes to add the key to PuTTY’s cache and carry on connecting.

If you want to carry on connecting just once, without adding the key to the cache, hit No.

If you do not trust this host, hit Cancel to abandon the connection.”

Understand that in general, you will only get the above message the first time you log into your server on one particular computer. A server should have a host key and when you log into a server for the first time while using ONE particular computer, this host key is not cached in the registry. By clicking “Yes”, you are effectively placing the server’s host key into the registry of that one particular computer you are using. If you later go to your friend’s house and try to log into your server using your friend’s computer, you will get the above message again because your friend’s computer does not have that server host key cached in his/her computer’s registry. Get it? Also, if you ever have to completely reinstall Windows on your local PC from scratch, you’ll get the above message again because you wiped out your registry that contained the server host key.

Click “Yes”.

A new window with a black background will open. It looks just like a DOS window. You should see a prompt that says, “login as:”.

Enter root

It should then say, “root@##.###.##.##’s password:”. Enter your root password. Note that while entering your password, the cursor will not move, nor will you see asterisks * while you type the password.

If you entered your correct root password, you will successfully log in as root at this time. You will get a message saying:

“Last login: blah blah blah”

It is important that you note when and where you last logged in from.

It will say the date, time, and what ISP was used.

If at any time in the future the stated last login is not recognized by you, then perhaps your server has been hacked and was logged in by someone else.

Directly under “Last login…”, you will see a default server welcoming message.

And directly under the welcome message is the Linux command prompt that looks like “[root@hostname]$”.

If you loged in as ordinary user

Log in as superuser root. Enter su –

Note: Be sure you are entering su –

The system asks for your root password, so enter your root password. Once again, note that while entering your password, the cursor will not move, nor will you see asterisks * while you type the password.

If you correctly entered your root password, you will then be successfully logged into your server box as superuser root. The command prompt will change to look like “[root@hostname /root]#”.

That’s it. You did it. This is where you will perform the bulk of your server tasks. To completely get out of this, simply either enter “exit” twice or “logout” twice.

Always use SSH and never Telnet. SSH is very secure if you do it correctly, Telnet is not.

On a final note, be very careful when entering and executing commands at the Linux shell prompt. Be sure you are watching exactly what you type and be sure that before you hit the “enter” button on your keyboard that everything you typed is correct. If you are not careful or you rush things, you could inadvertently wreak havoc on your entire server.

For example with the “rm” command, if you enter the following command by accident:

rm -rf /

(warning: NEVER do this one)

when you actually meant to type for example

rm -rf /host

You will literally wipe out your server’s hard disk of all directories and files!

Happy rooting!

Posted in Windows. Bookmark the permalink.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.