Ubuntu Fresh Install - Enable SSH root login PermitRootLogin

Ubuntu - Enable SSH root login PermitRootLogin

Fresh installing the Ubuntu Operating System generally the root user ssh will be disabled. Enabling login of root user using ssh we need to modify the file under etc ssh directory.
 
 
Ubuntu Fresh Install Enable SSH root login PermitRootLogin

 
Step 1: Edit the file /etc/ssh/sshd_config
 
vi /etc/ssh/sshd_config
 
Step 2: Look for field #PermitRootLogin yes and un comment the line in front of this line that is #. 
 
PermitRootLogin yes
 
Step 3: After removing the comment from PermitRootLogin restart the sshd service.
 
# service sshd restart
# echo $?
0
 
Step 4: Confirming Status (Optional) sshd pid will change upon restarting the sshd with this we get to know that sshd has restarted.
 
# ps -ef | grep sshd
root         889       1  0 11:45 ?        00:00:00 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups
# service sshd restart
# echo $?
0
# ps -ef | grep sshd
root         931       1  0 11:46 ?        00:00:00 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups

Checking the SSH daemon status with status command
 
# service sshd status
* ssh.service - OpenBSD Secure Shell server
     Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
     Active: active (running) since Thu 2018-09-03 11:46:56 CDT; 1min 19s ago
       Docs: man:sshd(8)
             man:sshd_config(5)
    Process: 930 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
   Main PID: 931 (sshd)
      Tasks: 1 (limit: 9861)
     Memory: 8.0M
     CGroup: /system.slice/ssh.service
             `-931 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups

Sep 03 11:46:56 localhost systemd[1]: Starting OpenBSD Secure Shell server...
Sep 03 11:46:56 localhost sshd[931]: Server listening on 0.0.0.0 port 22.
Sep 03 11:46:56 localhost sshd[931]: Server listening on :: port 22.
Sep 03 11:46:56 localhost systemd[1]: Started OpenBSD Secure Shell server.

With this we enable the command for root user.


Post a Comment

0 Comments