Technology Encyclopedia Home >How to create and manage user accounts on Ubuntu?

How to create and manage user accounts on Ubuntu?

Creating and managing user accounts on Ubuntu involves several steps, primarily using the command line interface. Here’s a basic guide:

Creating a User Account

To create a new user account, you can use the adduser command. Open the terminal and type:

sudo adduser username

Replace username with the desired username. The system will prompt you to enter additional information like the user's full name, room number, work phone, etc., which are optional. You will also be asked to set a password for the new user.

Managing User Accounts

Listing Users

To list all users on the system, you can use:

cat /etc/passwd

This command displays a list of all users along with some additional information.

Deleting a User Account

To delete a user account, use the deluser command:

sudo deluser username

Replace username with the name of the user you want to delete. Note that this command only deletes the user's account and home directory. If you also want to delete the home directory, use:

sudo deluser --remove-home username

Modifying User Accounts

To modify user account details, you can use the usermod command. For example, to change a user's home directory:

sudo usermod -d /new/home/directory username

Or to add a user to a group:

sudo usermod -aG groupname username

Example

For instance, to create a user named john, you would run:

sudo adduser john

You would then follow the prompts to set up john's account.

Cloud-Related Recommendation

For managing users in a cloud environment, especially if you're using cloud services like those offered by Tencent Cloud, you might want to look into Identity and Access Management (IAM) services. Tencent Cloud IAM allows you to create, manage, and control access to cloud resources securely. It provides fine-grained access control to ensure that users have only the permissions they need.

Using IAM services can help streamline user management across multiple cloud resources and applications, enhancing security and compliance.