Vous êtes sur la page 1sur 19

How to Login to the Linux Server from a Windows Workstation using PuTTY

Objective: The Objective of this document is to login successfully to the Linux Machine (Centos 5) using
SSH and Transfer files securely via SFTP.

Information:
Linux Server IP: 192.168.248.67
Linux Server Hostname: MNLCTO01

Requirements (Software’s that you need):


A fully functional Linux Server (Centos 5) w/ SSH enabled.
PuTTY software (PUTTY.exe)
PuTTY key generator software (PUTTYGEN.exe)
Pageant software (PAGEANT.exe)
WinSCP software (wnscp405.exe)
Here is the Step-by-step guide on how to connect to the Linux server via SSH.
Using PuTTY software
1. Using the username and passwords given, try to connect to the Linux Machine using PuTTY.

2. Open the Putty.exe software, then the program will appear and you will this:
3. Under the Category "Session" type in the IP address or Hostname of the Linux Server example "192.168.248.67" or
"MNLCTO01"

.
The protocol should be "22" by default (don't change this). Press "Enter" to continue.
4. Login using the username given to you. Hit "Enter" to proceed.

5. Type in your password. Hit "Enter" to continue.


6. Once you have logged in, you can see your username on the Command Line:

7. Now, you will need to generate the local RSA key:


Type in the following: # ssh-keygen -t rsa

8. Hit "Enter" to continue. By default, the keys will be saved at the location /home/username/.ssh the “id_rsa” is the
actual keyfile.
9. Now, the directory has been created. You have to enter the passphrase, if you don't want a passphrase leave it
blank. To proceed hit "Enter".

10. The keys have been generated. To verify you can go to the directory /home/testuser1/.ssh.
Type in: #cd /home/testuser1/.ssh if you username is Michael type in: #cd /home/michael/.ssh
11. To verify the files inside the directory. Type in: #ls –la

12. Copy the id_rsa.pub to authorized_keys. Type in the following: # cp id_rsa.pub authorized_keys. To verify, again
type in: #ls -la you will see that it has been added into the directory.
13. Now, we have to SSH to the server to established ourself and be added into the known_host.
Type in the following: # ssh testuser1@MNLCTO01 or ssh testuser1@localhost
If your username is raul, the command should be: # ssh raul@localhost or # ssh raul@ MNLCTO01
14. Enter the passphrase you enter when creating the keys. If none leave it blank then Hit "Enter".

15. Now, you have already been added to the Known_hosts file. To verify make sure you are in the directory
/home/testuser1/.ssh if not, type in: #cd /home/testuser1/.ssh then, type in: #ls –la
Using WinSCP
1. Run winscp405. Enter the IP Address/hostname of the server (192.168.248.67 or MNLCTO01). Also, enter your
username and password. Once you are ready Hit "Login"

2. To Continue, Click "Yes".

3. Now you have already connected to the Linux server (as you can see below.). Go to the .ssh folder
4. Copy the following files in the .ssh folder to your local Windows workstation. Copy id_rsa id_rsa.pub and
known_hosts to your local workstation ex. C:\My Documents
To select the files click on the files while pressing the “CTRL” button, the drag it to the left then click “Copy” or Hit
“F5”

Using the PuTTY keygen


1. Open PuTTY keygen software. Import the keys that you copied from the linux server.
2. Import the keys id_rsa and enter the passphrase
3. Then, save the public and private keys on your workstation.

4. Save it to any location on your local machine. After you have save it we will try to test it using PuTTY to login.

Testing the keys


1. Open the Putty.exe software, then the program will appear.
Under the Category "Session" type in the IP address or Hostname of the Linux Server example "192.168.248.67" or
"MNLCTO01"
2. Then, under the Category "Connections>>SSH>>Auth". We need to attached the private key file, Click "Browse"
and locate the private key file where you saved it previously. Click “Open” to attached it.

3. Once the private key is attached make sure you have entered the IP address/Hostname in the Category "Sessions".
When you are ready click "Open" to connect to the Linux server.
4. Login using your username.

5. Enter your passphrase for keys.


6. You have successfully login using the attached keys.

Using Pageant software


1. Open Pageant.exe by default you can see it on the task bar.
2. Right click on the Pageant icon on the taskbar. Click "Add keys" and locate the private key file.

3. Enter the passphrase, and then click “OK”.

Testing SSH connection using Pageant


1. Open PuTTY.exe, on the Category "Session" enter the IP Address/Hostname.
In the Category "Connection>>SSH>>Auth" make sure the checkbox Attempt Authentication using Pageant is
checked.
2. Login using your username and then Hit "Enter"

You were now able to connect to the Linux Server using just your username!
Testing SFTP connection
To connect via SFTP to the Linux server type in:
# sftp localhost or # sftp 192.168.248.67 or # sftp MNLCTO01
Then enter the passphrase of the key.

Vous aimerez peut-être aussi