SoFunction
Updated on 2025-03-10

How to switch between root and ordinary users in ubuntu (recommended)

After logging in to ubuntu, the default is the normal user permissions. So how to switch between ordinary user permissions and root permissions? The following summarizes how to switch between them.

Ordinary user switch to root user

After logging in to ubuntu, press the key combination CTRL+ALT+T to enter the terminal interface. The general terminal interface defaults to the ordinary user permission mode. There are the following methods for how to enter the root user from the ordinary user:

1. Press su, then enter the corresponding root password as prompted, and you can log in to root permissions.

2. Press sudo su, and then enter the corresponding root password as prompted to log in to root permissions (under this command, you generally do not need to enter the corresponding root password).

3. Press su root, and then enter the corresponding root password as prompted to log in to root permissions.

There are three types of root user switching to ordinary users:

1. If you want to switch back to the user from the root user, just execute the command: su user (user is the user name you installed by yourself).

2. Enter exit directly,

3. Ctrl+D key combination exit

How to set a password for root user:Just execute the command: sudo passwd root and follow the prompts step by step.

Disable and enable root login

Execute sudo passwd -l root (just disable root, but the root password is still saved), and then execute su root and find that the authentication failed (but the sudo su command can still enter root mode).

To start root login again, execute sudo passwd -u root ie.

The above article on the switch between root and ordinary users (recommended) is all the content I share with you. I hope you can give you a reference and I hope you can support me more.