In Linux, user management is often required. Of course, this includes adding, deleting, and modifying user passwords. 1. the adduser format is adduserusername. note: this command automatically creates users, user groups, and user home directories. you must enter the user password. While useradd creates only one user.
In Linux, user management is often required. Of course, this includes adding, deleting, and modifying user passwords.
1. adduser
Format: adduser username
Note: this command automatically creates the user, user group, and user home directory, and requires you to enter the user password. While useradd creates only one user, nothing else will be processed. Note that this command requires the root user group to grant specific execution permissions.
Instance:
Development:/home # adduser tx
Adding user 'tx '...
Adding new group 'tx '(1008 )...
Adding new user 'tx '(1008) with group 'tx '...
Creating home directory '/home/tx '...
Copying files from '/etc/skel '...
Enter a new UNIX password:
Re-enter the new UNIX password:
Passwd: The password is successfully updated.
Changing user information of tx
Enter a new value or press the Enter key to use the default full name []: room number []: work phone number []: home phone number []: other []:
Is the information correct? [Y/n] y
Development:/home #
2. delete user userdel
Format: userdel-r username
Note: this command will directly delete all user information, including user information and user home directories.
Instance:
Development:/home # userdel-r tx
Development:/home # su tx
Unknown id: tx
3. change the user password passwd
Format: passwd username
Note: this command directly modifies the password of a user.
Instance:
Development:/home # passwd root
Enter a new UNIX password:
Re-enter the new UNIX password:
Passwd: The password is successfully updated.