Managing Users in Ubuntu
User management is an essential part of maintaining a secure and organized Ubuntu system. This guide provides you with various commands and procedures for managing users on your Ubuntu system.
Listing All Users
To list all users on your system, you can use the following command:
|
|
Adding a New User
You can add a new user using either of the following commands:
|
|
or
|
|
For more information on the difference between adduser
and useradd
, refer to the section What is the difference between adduser and useradd?.
Removing a User
To remove or delete a user, follow these steps:
- Delete the user account:
|
|
- Optionally, you may want to delete the user’s home directory:
|
|
Please exercise caution when using the rm
command, as it will permanently delete the user’s files and directories.
Modifying User Attributes
Changing the Username
To change a user’s username, you can use the usermod
command:
|
|
Changing the Password
To change a user’s password, use the passwd
command:
|
|
Changing the Shell
To change the default shell for a user, utilize the chsh
command:
|
|
Changing User Details
To modify a user’s details, such as their real name, you can use the chfn
command:
|
|
Additional Resources
For more detailed information and options regarding user management, consult the manual pages for the relevant commands. Use the following commands to access the manual pages:
man adduser
: Manual for theadduser
command.man useradd
: Manual for theuseradd
command.man userdel
: Manual for theuserdel
command.- And more: You can explore other user management commands by using the
man
command followed by the command name.
Proper user management is crucial for system security and organization. Be cautious when making changes to user accounts, especially when deleting user data. Always have up-to-date backups and consider the implications of each action.