root switch in ubuntu

1. Switch from user user to root

When we need to perform some operations with root privileges (such as repairing system files), we often need to use sudo authorization, which is very troublesome. At this point we can switch to the root user, just execute sudo su 

 

Ubuntu's root user does not have a fixed password, its password is randomly generated and dynamically changed

Yes, it seems to change every 5 minutes, so using su (switch user) is not possible, because we don't know the root password

 

2. Switch back to user user from root user

If you want to switch back to the user user from the root user, just execute the command: su user  (user is the user name when you installed it yourself), or directly enter exit, or Ctrl+D key combination to exit

 

 

 

 

 

Guess you like

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