• Javascript
  • Python
  • Go

Adding a User in Ubuntu: Step-by-Step Guide

Ubuntu is a widely popular operating system that is known for its user-friendly interface and powerful features. One of the key features of ...

Ubuntu is a widely popular operating system that is known for its user-friendly interface and powerful features. One of the key features of Ubuntu is its ability to have multiple users on the same system, each with their own settings and preferences. If you are new to Ubuntu and want to add a new user to your system, this step-by-step guide will walk you through the process.

Step 1: Open the Terminal

To begin, open the Terminal by pressing the Ctrl+Alt+T keys on your keyboard. The Terminal is a command-line interface where you can enter commands to perform various tasks on your system.

Step 2: Switch to Root User

In order to add a new user, you need to have root privileges. To switch to the root user, enter the command "sudo su" in the Terminal and press enter. You will be prompted to enter your password, after which you will have root access.

Step 3: Create a New User

To create a new user, use the "adduser" command followed by the username you want to create. For example, if you want to create a user named "John", the command would be "adduser John". You will then be prompted to enter a password for the new user and confirm it.

Step 4: Set User’s Home Directory

By default, Ubuntu creates a home directory for each user in the /home directory. However, if you want to change the location of the home directory, you can use the "-d" option in the adduser command. For example, if you want to set the home directory for John to /mnt/home, the command would be "adduser -d /mnt/home John".

Step 5: Assign User to User Groups

In Ubuntu, each user is assigned to a primary user group and can be a part of multiple secondary user groups. To assign a user to a secondary user group, use the "-G" option followed by the group name. For example, if you want to add John to the "developers" group, the command would be "adduser -G developers John".

Step 6: Set User’s Shell

Each user has a default shell which is used to execute commands. To change the default shell, use the "-s" option followed by the shell name. For example, if you want to set the default shell for John to /bin/bash, the command would be "adduser -s /bin/bash John".

Step 7: Verify User Creation

Once you have completed all the above steps, you can verify if the user has been created successfully by using the "id" command followed by the username. For example, "id John". This will display the user ID, primary user group, and secondary user groups that the user is a part of.

Step 8: Exit Root User

After you have successfully created the new user, you can exit the root user by using the "exit" command in the Terminal.

Step 9: Switch to New User

To switch to the newly created user, use the "su" command followed by the username. For example, "su John". You will be prompted to enter the password for the user, after which you will have access to the user’s home directory.

Congratulations, you have successfully added a new user to your Ubuntu system. The new user will now be able to log in and use the system with their own settings and preferences. You can repeat the above steps to add multiple users to your system.

In conclusion, adding a new user in Ubuntu is a simple process that can be done through the Terminal. By following this step-by-step guide, you can easily create new users and manage them on your system. With Ubuntu’s multi-user feature, you can have a personalized experience for each user and ensure the security of your system.

Related Articles

Best Database ERD Tools for Linux

Linux is an open-source operating system that is widely used for its flexibility, stability, and security. It is a popular choice among deve...

Finding GTK+ Version on Ubuntu

GTK+ is a powerful open-source framework that allows developers to create user interfaces for their applications on Linux systems. This popu...

Opening Terminal in Eclipse

Eclipse is a popular integrated development environment (IDE) used by programmers and developers worldwide. It offers a wide range of featur...

Automating Firefox using Python

As technology continues to advance, automation has become an essential tool for streamlining tasks and increasing efficiency. In the world o...