How to switch to root user in Linux

In a Linux system, you can use the following command to switch to the root user:

  1. If you are already logged in as the root user, you can execute the following commands directly on the command line:
su -

This will switch your current session to that of the root user.

  1. If you are logged in as a normal user, you can use the following command to switch to the root user:
sudo su -

This will prompt you for the password of the current user, which will switch your current session to that of the root user.

Please be extremely careful when using root privileges, as misuse can cause serious problems with your system.

Guess you like

Origin blog.csdn.net/weixin_42594427/article/details/129609990