Enabling root user in Ubuntu

  • Last Created On Dec 09, 2024
  • 8
0 0

Instructions on how to enable root user in a newly installed Ubuntu server.

The root user in Ubuntu is disabled by default because the password is not set.

To enable root user:

1. Set root password

customer@ubuntu:~$ sudo passwd root
Enter new UNIX password: # set password
Retype new UNIX password: # confirm password
passwd: password updated successfully
customer@ubuntu:~$ su -
Password: # enter root password
root@ubuntu:~$


2. Limit users to switch to root

root@ubuntu:~$ vi /etc/pam.d/su
(Find line): #auth required pam_wheel.so

(Change to): auth required pam_wheel.so group=adm

root@ubuntu:~$ usermod -G adm customer

3. Enable root login for OpenSSH

root@ubuntu:~$ vi /etc/ssh/sshd_config
(Find line): #PermitRootLogin no

(Change to): PermitRootLogin yes

(Find line): #PasswordAuthentication no

(Change to): PasswordAuthentication yes

4. Restarting OpenSSH

root@ubuntu:~$ /etc/init.d/ssh restart
root@ubuntu:~$ /etc/init.d/ssh status
Notes:

Red text = input commands

customer@ubuntu:~$ = example of what may appear on screen depending on hostname assigned etc.
Views: 8

Recent Articles

  • How to Install JAX with ROCm Acceleratio...
    96
  • Deploy a PyTorch Workspace on a Vultr Cl...
    71
  • Managing Backup Storage
    83
  • Automating FTP Backups in Windows Server
    71
  • Automating FTP Backups in Linux
    75

Popular Articles

  • Our General Terms & Conditions
    2632
  • Our Privacy Policy
    2477
  • Our Cookies Policy
    275
  • Our Terms of Use
    152
  • How to Install JAX with ROCm Acceleratio...
    96