Change username and password in ubuntu

1. Set root user password

sudo passwd root

The terminal displays: Enter new UNIX password:

Just enter the password twice in a row;

The final display: passwd: password updated successfully

Enter the root user, and the following operations must be performed under root permissions, ensuring that the user name and password are inconsistent;

2. Modify user password

sudo passwd user(用户名字)

Just make changes according to the prompts;

To modify the username, the three steps are to change it to your own username.

sudo vi /etc/passwd
sudo  vi /etc/shadow 
sudo vim /etc/group

3. Modify the host name


sudo vi /etc/hostname#将其中的名字改为自己的名字
sudo vi /etc/hosts#将其中的名字改为自己的名字

 4. Modify user directory

sudo mv oldname newname

Complete the above steps and restart.

Guess you like

Origin blog.csdn.net/weixin_46658531/article/details/130850224