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

Friday, June 17, 2016

Accessing Linux (Ubuntu) account remotely through SSH

Its easy to access your linux account exactly sitting in-front of the personal computer. But how about accessing your linux account from another place which is far from the personal computer. Follow below steps to access your linux account.
Definition
Target Computer: the computer to which you want to connect or we can say your personal computer. <refer figure 1>
Source Computer: The computer from which you want to access your target computer. <refer figure 1>
Figure 1: Accessing target Computer from Source computer



Requirement:
    1. Target computer must be turned ON

    2. Target computer must have internet connection
        or
        Source computer must be accessible from target computer through LAN, WAN or in anyway.

    3. Software requirement for Source Computer :
        Putty: which can be downloaded from below link
        For windows: http://tartarus.org/~simon/putty-snapshots/x86/putty.exe
        For Mac & Ubuntu : Use “Terminal” . // No third party software is required
       
    4. Software requirement for Target Computer :
        openssh-server : openssh-server must be install on your personal computer to accept the connection from another computer present remotely

Steps

For Target Computer
  1. We assume that Ubuntu is installed on target computer
  2. Install openssh-server by executing below command in the “Terminal”
sudo apt-get install openssh-server
      3. follow below link to configure the openssh-server
               http://blogchinmaya.blogspot.com/2016/06/configure-openssh-server-in-ubuntu.html

For Source Computer

For Windows

    S1: download and install Putty for windows from below link.
    S2: Open putty
Figure 2: Putty in Windows


    S3: Here, it needs 2 main information.
         S3.1: Enter the address of the target computer
         S3.2: Enter the ssh port number on target computer
    S4: Select "SSH" radion option
    S5: now click on "Open" button to connect to the target computer
Figure 3: Putty Login window 
     S6: Now enter your username and password

For Mac & Linux (ubuntu)

    S1: open Terminal (FOR MAC)
         S1.1 : press <command> + <Space
         S1.2 : search for “terminal

Figure 4: Open terminal in mac
    S1: Open Terminal (for Ubuntu)
         You can open the trminal by pressing < ctrl > + < alt > + < t

    S2: gather following information
           S2.1: Account name and password in target computer
           S2.2: address of the target address
           S2.3: port, on which ssh server is running on the target computer
    S3: enter following command in terminal
ssh <username>@<address> -p <port number>
           Now enter your password
e.g.


Thats all, its done. Now you can browse the your filesystem using common linux command.