Tuesday, 30 June 2015

How to enable root login ubuntu-15.04-server

The root user in Ubuntu is disabled by default because his password is not set. But if you'd like to use root user by some reason, enable it like follows.

Set root password.

root@amir:~$ sudo passwd root
Enter new UNIX password:                    # set root password
Retype new UNIX password:                # confirm
passwd: password updated successfully

root@amir:~$ su -
Password:                           # root password
root@amir:~                       ## just switched             

If you enable root, limit users to switch to root.

root@amir:~# vi /etc/pam.d/su
# line 15: uncomment and add a group that can switch to root
auth   required   pam_wheel.so   group=adm

root@amir:~# usermod -G adm root


No comments:

Post a Comment