User switching under linux

su is to switch between users, which can be switched from ordinary users to root users,

test@ubuntu:~$ su
Password: 
root@ubuntu:/home/test#

It can also be switched from the root user to a normal user. If you are currently the root user, then switch to the normal user test with the following command: su - test

 

root@ubuntu:~# su - test
[sudo] password for test: 
test@ubuntu:~$

If you want to switch back to the root user, use the following command: su or su -username root can be omitted. When switching back to the root user, enter the root password. Generally, you can directly enter the exit command to switch back to the root user, so that you do not need to enter a password.

 

test@ubuntu:~$ exit
logout
root@ubuntu:~#

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325468743&siteId=291194637