Firstly, download the putty from https://the.earth.li/~sgtatham/putty/latest/w64/putty.exe
Remote Login
There are times when we have access to physical servers and we can login directly from the server console in front of the server, or at least next to the server via KVM console. But, most of the time we don’t have access to the physical server so that we have to login remotely to the server. In this tutorial we’ll learn how to login remotely to a Linux Server using Secure Shell (SSH). Of course, you can also use this tutorial as guide to login to *NIX family operating systems if they have SSH installed.
Tools
- On Linux you can always use Terminal application. This application should be available no matter what desktop environment that you use.
- MacOS X also has Terminal.app installed by default. You can also use iTerm2 as Terminal alternative on Mac.
- Windows does not have an SSH client or server included. You can use PuTTY to do remote SSH logins from Windows. You can download PuTTY for free. You can download the individual program or PuTTY installer that not only installs PuTTY but also additional programs like puttygen.
Login Using a Password
The simplest way to login to Linux Server is using a password as an authentication mechanism. In this section we’ll learn how to login to Linux server using a username and password pair.
Login From Linux or MacOS X
Linux, MacOS X and most UNIX variants have SSH installed by default, you don’t need to install any additional packages unless you only install the minimalist package that does not install openssh package. In this tutorial I assume that you already have ssh client installed.
To login to a Linux server using ssh you can use the command below:
$ ssh username@server
Another way to login is using the -l option for username:
$ ssh server -l username
In case you need to access a server that is not using SSH default port (22), you can specify an SSH server port number using -p option. In the example below the SSH port is 2222.
$ ssh server -l username -p 2222
In the example below, we try to login to server 128.199.138.34 using username root.
$ ssh 128.199.138.34 -l root
The authenticity of host ‘128.199.138.34 (128.199.138.34)’ can’t be established.
RSA key fingerprint is 90:8c:7d:f8:ae:1a:09:60:44:08:3b:d9:c9:f7:c4:76.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘128.199.138.34’ (RSA) to the list of known hosts.
[email protected]’s password:
The warning above is shown if you are connecting to the server for the first time. The SSH client will check the authenticity of the server by checking the SSH fingerprinting. Since this is first time connection, SSH does not have any record of this server fingerprint and wil ask you whether you want to trust this server or not. You can type yes on the question above and input your password.
If you have logged into this server before and you get this message again there are several possibilities that could happen:
- Your server is reinstalled and of course the SSH fingerprint changed.
- Your server compromized or someone act as man in the middle (MITM), so instead of connecting to the real server you are connecting to the MITM machine.
- Wrong change on DNS records entry so you are connecting to the wrong server.
Login from Windows
Now we’ll learn how to login to a Linux Server from a Windows Machine using PuTTY. I assume that you already download PuTTY.
- Input the server address, this can be a hostname or IP Address
2.If you login to this server for the first time you will get a security alert regarding server fingerprint. If you are sure that you’re connecting to the right server, you can click Yes.
3.You must input your username and password to login.
Linux machine
The tool on Linux for connecting to a remote system using SSH is called, unsurprisingly, ssh.
The most basic form of the command is:
· $ ssh remote_host
The remote_host in this example is the IP address or domain name that you are trying to connect to.
This command assumes that your username on the remote system is the same as your username on your local system.
If your username is different on the remote system, you can specify it by using this syntax:
· $ ssh remote_username@remote_host
Once you have connected to the server, you will probably be asked to verify your identity by providing a password.
Later, we will cover how to generate keys to use instead of passwords.
To exit back into your local session, simply type:
· $ exit