Tip: After the article is written, the table of contents can be automatically generated. How to generate it can refer to the help document on the right
Article directory
foreword
提示:这里可以添加本文要记录的大概内容:
The novice period, as a record of learning Ubuntu, also paves the way for other novices.
Into the title.
1. Modify user password
It is relatively simple to modify the user password, so let's put it in front.
And change the user name first, change the password directly without restarting, and errors may occur after restarting after all changes.
First switch to the root user to modify. After modifying the user name as a normal user, the sudo command will prompt that the password is incorrect.
First open the terminal and enter the command. Open the terminal shortcut key: ctrl+alt+t
sudo su
sudo passwd username #修改用户密码
//username是用户设置用户名,记得替换
sudo passwd root #修改root密码
As shown in the figure, the modification is successful.
2. Modify the username
1. Modify the passwd file
Enter the command, open the file, slide to the bottom, and change the user name to what you want.
vi /etc/passwd
As shown in the figure, normally there are three places that need to be modified. Press the key i or a to modify. After the modification, esc can exit the modification mode, and then enter: wq to exit the file. Special attention should be paid to the input:
if you want to exit directly without modification, enter: qa
2. Modify the shadow file
same operation
vi /etc/shadow
There is only one thing that needs to be modified.
3. Modify the folder name in the home directory
For a simpler operation, enter the following command on the command line
mv /home/原用户名/ /home/新用户名
4. Modify sudo permissions (modify group user group)
Same as above, change the old username to the new username.
vi /etc/group
There are many places to be modified. It is recommended to read line by line and change line by line from top to bottom.
Summarize
Then all the changes are done, restart and call it a day.