User Tools

Site Tools


ubuntu:users:use_root_account

Ubuntu - Users - Use root account

The root Account in Ubuntu is disabled by default because its password is not set.

To use root priviledges, basically it's better to use the sudo command with administrative accounts.

But if you'd like to use root Account itself by some reason, it's possible to use like follows.


Use sudo interactive mode

sudo -i

Enter your password, and you will switch into privileged mode.


Switch to the sudo account

The user account added during installation is setup as an administrative account with sudo.

You can switch to root account's shell:

sudo -s

Enter your password, and you will switch into privileged mode.


Set the root account password

ALERT: This is NOT recommended.

sudo passwd root

Use su

ALERT: This is NOT recommended.

su -

su command restriction

It is recommended to restrict which users can su to root.

sudo vi /etc/pam.d/su

Edit #line 15: Uncomment and add a group which is allowed to run the su command

/etc/pam.d/su
...
auth       required   pam_wheel.so  group=adm
...

NOTE: The pam_wheel PAM module is used to enforce the so-called wheel group.

By default it permits root access to the system if the applicant user is a member of the wheel group.

Add users to this group, who are allowed to issue the su command.

usermod -G adm john
ubuntu/users/use_root_account.txt · Last modified: 2020/07/15 09:30 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki