User Tools

Site Tools


ubuntu:users:use_root_account

This is an old revision of the document!


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 the installation user 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.

Limit or prohibit shells in sudoers config.

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
...

Add users to this group.

usermod -G adm john
ubuntu/users/use_root_account.1575810790.txt.gz · Last modified: 2020/07/15 09:30 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki