Linux reset password method and user switch

Since the local vmware has not been used for a long time, the password of the local virtual machine has been forgotten. This rare problem encountered, Baidu solved it.

Learning source: https://www.cnblogs.com/lippor/p/5537931.html

Just go to the boot interface e and then e select 2 and then b enter the new password; init 6 restart

Note that the password for the root user is modified

id: View the information of the currently logged in user

To modify the passwords of other users, you can view the current user list: cat /etc/passwd 500 (third parameter) accounts above are created by later users;

Then change the password: passwd admin (user name) Enter the new password twice to change the password of the root user whose password will not be displayed, just passwd

The etc directory is generally used to store configuration files

The current login is the root user to switch to other users: su admin $ ordinary user

Switch back to root su root # root user

cat /etc/group View group information

su switch user

sudo can execute commands with the same permissions as the root user without switching users

grep is a powerful text search tool

 

Guess you like

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