Secure Shell (SSH) is a protocol which is used to access Linux servers remotely. In short, we can say it allows the secure exchange of data between two computers. Commonly port 22 is used to connect one computer to another. You can also change this port editing its configuration file.
System Administrator normally use the SSH protocol technology as a remote control way of managing servers that are dedicated to their business.
By default, SSH client comes installed in almost all of the Linux Distro. To access the Linux server you will need to enable ssh service to make it work. It is very simple to install SSH server on Linux machine.
On Ubuntu or Debian System
Follow the below command to install the SSH server and client.
$ sudo apt-get install openssh-server openssh-client
On Redhat or RPM Based Distributions
Follow the below command to install the SSH on RPM based distributions.
# yum -y install openssh-server openssh-clients
Start and Stop SSH Service
For security reason you can disable SSH service if you don’t want anyone to login to your server.
# service sshd stop # service sshd start
Edit SSH Configuration File
By default, SSH service runs on 22 port, you can also change the default port editing its configuration file. You can also enable or disable root login for security purpose, enable or disable empty password login.
# vim /etc/ssh/sshd_config
Now you can connect your server. To connect your server you will need to provide username available on your server followed by ‘@‘ and the domain name or IP address of your server.
# ssh [email protected]_name_or_IP_address
After running above command enter the password when prompted and have access the server. After logged in
successfully, you are provided with the bash shell.
I have a server, IP 192.168.0.15 and I have a user account on this server named “neo“. Now lets see we can access this server using SSH.
On Linux Operating system
Now open your terminal and enter the below command
# ssh [email protected]
You will get a message like below.
The authenticity of host ‘192.168.1.104 (192.168.1.104)’ can’t be established. ECDSA key fingerprint is 50:fc:87:46:4e:68:50:dd:77:9d:ca:ed:ec:37:4a:5b. Are you sure you want to continue connecting (yes/no)?
Here you have to type “yes“. This message comes the first time you login to a server using ssh.And finally it will ask for the password
On Windows Machine
To access Linux server on your Windows Operating System you will need to install SSH client like putty etc.,
How To Connect Amazon EC2 Instance Using PuTTY Private Key
How to Connect Android Phone and Tablet to PC Using Putty and SSH
How to Backup, Restore & Remove PuTTY Data
For more detailed information about SSH have a look at its man page
# man ssh