1 Introduction
When we get a copy of someone else's system, often you need to modify the code to copy the system, the user name and host name, paper briefly describes how to modify the configuration files in Ubuntu.
2, How to Modify
(1) change the root password
Run the following command to modify the root password, the command runs in the process need to enter a user password:
$ sudo passwd root
Follow the prompts to enter a new password, successful password change prompts to appear after the carriage return.
(2) modify the user password
Run the following command to modify the user password:
$ sudo passwd username
In the process of revision, the user will be prompted to enter a new password, and directly enter the input, modification is successful there will be a corresponding prompt.
(3) modify the hostname
Host string named after the @, use the following command to modify the host name:
$ sudo vim /etc/hostname $ sudo vim /etc/hosts
As modified, the original host name changed to the new host name, and then save out.
(4) modify the user name
After editing the host name, continue to modify the user name, you can use the following command to modify:
$ sudo vim /etc/passwd $ sudo vim /etc/shadow
These profiles found in the original user name and original user name to the new user name to, when there is a user name and passwords do not match, you can use root to modify the corresponding configuration file.
When we want to change the original group of users in the file belongs, you can use the following command:
$ sudo vim /etc/group
Vim editor used to modify, using the following command in the command mode:
:%s/old_username/new_username/g
All old_name strings in the / etc / group new_name text strings using replacement.
(5) modify the user directory
The original name of the user directory under / home directory for the new user to modify the name of the command, you can use the mv command to modify:
$ mv /home/old_name /home/new_name
Note: When a new user name can not sudo, you can refer to the following article to resolve.
https://www.cnblogs.com/Cqlismy/p/11050587.html
(6) to restart the system
Finally, the system is restarted, it will find a user name and host name have been modified to complete.