How to enable root login for SSH?

Many of us have faced this issue while using SSH. You can’t connect root user using SSH. Most of the time users need to login with normal user and then they have to switch the shell. I will show you how to do this for ubuntu or debian OS. This is common solution across Linux OS but debian and ubuntu are relatable for this.


Open sshd_config.

$sudo vim /etc/ssh/sshd_config

Remove comment from below line and make it on.

#PermitRootLogin Off

It should look like this.

PermitRootLogin on

Restart SSH Service.

$sudo systemctl restart sshd

Check SSH service status.

$sudo systemctl status sshd 
● ssh.service - OpenBSD Secure Shell server 
   Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: dis> 
   Active: active (running) since Tue 2019-10-08 13:26:19 IST; 3s ago 
     Docs: man:sshd(8) 
           man:sshd_config(5) 
  Process: 6727 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS) 
  Main PID: 6728 (sshd) 
    Tasks: 1 (limit: 4915) 
   Memory: 1.1M 
   CGroup: /system.slice/ssh.service 
           └─6728 /usr/sbin/sshd -D 
 
Oct 08 13:26:19 loopback systemd[1]: Starting OpenBSD Secure Shell server... 
Oct 08 13:26:19 loopback sshd[6728]: Server listening on 0.0.0.0 port 22. 
Oct 08 13:26:19 loopback sshd[6728]: Server listening on :: port 22. 
Oct 08 13:26:19 loopback systemd[1]: Started OpenBSD Secure Shell server. 
And it's done. You are all set to use it.

Comments

Popular Posts