Tuesday, September 1, 2020

How to Enable SSH on Ubuntu

 Sometimes it's not possible to direct access to our server. In that case, we used remote access feature. There are many remote access protocol available to accomplish this task. Such as telnet, SSH. From these protocols, some are working as secure way and some are insecure way. In that case, we can say that, "telnet" is the insecure protocol for the remote access and "SSH" is the secure protocol for the remote access. It can possible to intercept the "telnet" traffic on its way. But for the "SSH" it's difficult, sometimes it's not possible. 

Generally this service is getting installed during Operating system setup. It is select to get installed by default. If we are not sure the service is installed or not, then we can check the service status. For that, the command will be:-

systemctl status sshd.service

or

service ssh status

If it is installed, you will see the status as "active(running)" with green color. 


To enable or install this "SSH" protocol or service to the ubuntu machine, we have to execute the following command.

apt-get   -y   install   openssh-server

After the installation you can customize your ssh settings from "sshd_config" file which you will get the at "/etc/ssh" path. The complete command will be :-

vi   /etc/ssh/sshd_config

After modifying your configuration, you have to restart the SSH service. The command will be:-

systemctl   restart   sshd.service
or
service  ssh  restart

Again, you can check your service status.

[Note:- All command must be executed with root privileges.]

No comments:

Post a Comment