Tuesday, June 21, 2016

Configure openssh-server in ubuntu.

ssh enables one computer to communicate to another computer over a secure encrypted channel. In order to establish the environment we need both ssh server on the target computer and ssh client on the computer from where we intend to access the target computer.

In this post, we'll see how to install ssh-server on the target computer (server)



Requirement:
     OS on target computer : Ubuntu 14.04 or later
     Target computer must be connected to internet to get the required software packages.

Installation:


        1. open the terminal by pressing

 ctrl + Alt + t  


        2. Now enter the following command to install ssh-server

sudo apt-get install openssh-server

              Use sudo for if you are not in root, else you can avoid using

Configuring openssh-server:

        1. Configuration file : To configure, we need to modify sshd_config file present inside /etc/ssh/

        2. Backup : Before configuring, please take a backup of the configuration by entering following command in the terminal

sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config_backup

        3. Open configuration file by entering following command.
sudo nano /etc/ssh/sshd_config 
             
        4.  Configure ssh port number. Find the line
 port 22  
             now change the port number according to your requirement.
        5.  Deny root login: Find the line
 PermitRootLogin without-password  

             Now change the line to
 PermitRootLogin no  

        6.  Allow specific user : At the end of the file add following line.

 AllowUsers user1 user2  

             this will restrict all other users with username other then user1 and user2

Above are the basic configuration to start playing with ssh.
Don't forget to restart the ssh service after every modification. To restart the ssh server, use following command
sudo service ssh restart
   
For more information, just comment below.


-Thank you

No comments:

Post a Comment