How to Add Users in Linux?
Contents

Steps to Create a New Sudo User

  • Log in to your server as the root user. ssh [email protected]_ip_address.
  • Use the adduser command to add a new user to your system. Be sure to replace username with the user that you want to create.
  • Use the usermod command to add the user to the sudo group.
  • Test sudo access on new user account.

To create a user account from a shell prompt:

  • Open a shell prompt.
  • If you are not logged in as root, type the command su – and enter the root password.
  • Type useradd followed by a space and the username for the new account you are creating at the command line (for example, useradd jsmith).

To add/create a new user, all you’ve to follow the command ‘useradd’ or ‘adduser’ with ‘username’. The ‘username’ is a user login name, that is used by user to login into the system. Only one user can be added and that username must be unique (different from other username already exists on the system).To add a user to the system:

  • Issue the useradd command to create a locked user account: useradd <username>
  • Unlock the account by issuing the passwd command to assign a password and set password aging guidelines: passwd <username>

The comment can be added as a single line without any spaces. For example, the following command will add a user ‘mansi’ and would insert that user’s full name, Manis Khurana, into the comment field. You can see your comments in ‘/etc/passwd’ file in comments section.GUI: File permissions

  • Open Nautilus.
  • Navigate to the target file or folder.
  • Right click the file or folder.
  • Select Properties.
  • Click on the Permissions tab.
  • Click on the Access files in the Others section.
  • Select “Create and delete files”
  • Click Change Permissions for Enclosed Files.

What is the command to add a new user in Linux?

useradd

How do I list users in Linux?

There are several ways you can obtain the list of users in Linux.

  1. Show users in Linux using less /etc/passwd. This command allows sysops to list the the users that are locally stored in the system.
  2. View users using getent passwd.
  3. List Linux users with compgen.
Sophia Al-Mansoor

Sophia Al-Mansoor

Global Business & E-Commerce Reporter

Sophia analyzes international trade, startup ecosystems, retail transformation, and supply chain logistics for modern digital publications.

Share this article
Twitter Facebook Pinterest