Enabling root user in Ubuntu

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.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Installing Ubuntu Server on Drives Larger Than 2 TB

The following tutorial requires a motherboard that is EFI compatible (most boards since 2012 are...

Install MailCatcher On Ubuntu 14

Introduction MailCatcher is a tool that provides an easy way for developers to inspect emails...

Install PostgreSQL On Ubuntu 14

Introduction PostgreSQL is the world's most advanced open source Relational Database Management...

How to install PLESK on centOS & Ubuntu

InstallationThis is a guide on how to install PLESK. On centOS, Ubuntu. This command automates...

How to Update CentOS 7, Ubuntu 16.04, and Debian 8

When setting up a new Linux server, updating the system's Kernel and other packages to the latest...