• Pricing
DashboardContact Sales
  • Blogs
  • Discover
  • Docs
  • Community
  • AgentBeta
⌘K

Over 80,000,000 Cloud Servers Launched

Over 80,000,000 Cloud Servers Launched

Cloud ComputeCloud GPUBare MetalFile SystemObject StorageBlock StorageManaged DatabasesCDNServerlessKubernetesContainer RegistryDirect ConnectLoad Balancers
RegionsAdvanced NetworkControl PanelOperating SystemsUpload ISO
Industry CloudOne-Click DeploymentUse Cases
Browse AppsBecome a Vendor
FAQDevelopers / APIsVultr DocsServer StatusBug BountyPromotionsSolution PartnersStart-Up Programs
Our TeamNewsBrand AssetsReferral ProgramCreator ProgramCareersSLALegalVultr Trust CenterContactYour Privacy ChoicesSubprocessorsAccessibility
Contact SalesSign Up

© Vultr 2026 | VULTR is a registered trademark of The Constant Company, LLC.

Terms of ServiceAUPDMCAPrivacy PolicyCookie Policy

In this Article

PrerequisitesCreate a User in LinuxCreate a Sudo User in LinuxSwitch Users in LinuxView User Information in LinuxConclusion
  1. Docs
  2. Articles & Guides
  3. Linux Guides

How to Create Users in Linux

5 min readUpdated 30 June 2025
0 comments
How to Create Users in Linux header image

Creating users in Linux lets you set up specific user accounts responsible for specific tasks on a Linux system. Standard users are non-privileged users without any special administrative permissions, while privileged users (also known as sudo users) have full permissions to perform multiple tasks on a Linux system. Creating users ensures efficient security, organization, and efficient access control in a multi-user environment where each user has unique credentials, permissions, and file system space.

This article explains how to create users in Linux. You will create both standard user accounts and sudo users while verifying the user information to perform tasks on your Linux workstation.

Prerequisites

Before you begin, you need to:

  • Have access to a Linux-based instance as root or a non-root user with sudo privileges.

Create a User in Linux

Creating users in Linux requires superuser (sudo) privileges. You can create a new user using the useradd or adduser commands, depending on your Linux distribution. Follow the steps below to create a non-root standard user account using the useradd command in Linux.

  1. Run the useradd command, specifying the user to create, such as example-user.

    CONSOLE
    $ sudo useradd -m example-user
    Powered by Vultr AgentBeta

    The above command creates a new user example-user, with a home directory

    • Use the adduser command on Debian-based systems such as Ubuntu to create a new user with an interactive list of options.

      CONSOLE
      $ sudo adduser example-user
      Powered by Vultr AgentBeta

      The above command automatically creates a new user group and home directory. Enter a strong user password when prompted.

    • Use the -M -s /usr/sbin/nologin options with the useradd command to create a user without a home directory and a login shell.

      CONSOLE
      $ sudo usermod -M -s /usr/sbin/nologin example-user
      Powered by Vultr AgentBeta

      You can later modify the /etc/passwd as a sudo user to manually assign the user a login shell.

  2. Run the passwd command to set the new user password.

    CONSOLE
    $ sudo passwd example-user
    Powered by Vultr AgentBeta

    Enter a strong user password and confirm it when prompted.

    New password: 
    Retype new password: 
    passwd: password updated successfully
  3. List the /home directory and verify that the user's home directory is available.

    CONSOLE
    $ ls /home/
    Powered by Vultr AgentBeta

    Your output should be similar to the one below.

    example-user  ....
  4. View the /etc/passwd contents and verify that user information.

    CONSOLE
    $ cat /etc/passwd | grep example-user
    Powered by Vultr AgentBeta

    Output:

    example-user:x:1001:1001::/home/example-user:/bin/sh

    The above string specifies the user information, IDs, home directory, and the default shell, including:

    • example-user: The username.
    • x: A placeholder for an encrypted password stored in the /etc/shadow file.
    • 1001: User ID (UID).
    • 1001: Group ID (GID).
    • :: User description.
    • /home/example-user: The user's home directory.
    • /bin/sh: The user's default shell environment. /bin/sh specifies the default sh shell, while a value such as /bin/bash specifies the bash shell.

Create a Sudo User in Linux

A sudo user is a regular user in Linux with super user do (sudo) privileges. A sudo user can perform administrative tasks on a Linux system using the sudo command, enabling access to the entire file system. Accessing a Linux workstation as root exposes the system to security threats associated with super user tasks. Creating a sudo user in Linux lets you perform administrative tasks without logging in as the root user. Follow the steps below to create a sudo user or convert an existing user into a sudo user in Linux.

  1. Create a new user such as linuxuser to grant sudo privileges.

    CONSOLE
    $ sudo useradd -m linuxuser
    Powered by Vultr AgentBeta
    • Use adduser on Debian-based systems.

      CONSOLE
      $ adduser linuxuser
      Powered by Vultr AgentBeta
  2. Use the usermodcommand with the -aG option, specifying the sudo users group and the target user to grant sudo privileges:

    • On Debian-based systems such as Ubuntu, use the adduser command and the sudo group, granting the user sudo privileges.

      CONSOLE
      $ sudo usermod -aG sudo linuxuser
      Powered by Vultr AgentBeta
    • On RHEL-based systems such as CentOS, Rocky Linux, and Alma Linux, use the wheel group, granting the user sudo privileges.

      CONSOLE
      $ sudo usermod -aG wheel example-user
      Powered by Vultr AgentBeta
    • On other Linux systems such as OpenSuse, use the wheel group, granting the user sudo privileges.

      CONSOLE
      $ sudo usermod -aG wheel example-user
      Powered by Vultr AgentBeta

      Within the above command:

      • -aG: Specifies the group to add the user without removing them from other groups.
      • sudo: The group to add the user.

Switch Users in Linux

You can switch users in Linux using the su (substitute user) command, specifying the user to switch. The - option switches to the user's home directory and loads the user's shell environment. Non-sudo users need the user's password to switch to the user, while using sudo su does not prompt you for a password to switch to a user.

  1. Use the su - command, specifying the user to switch to in Linux.

    CONSOLE
    $ su - linuxuser
    Powered by Vultr AgentBeta

    Enter the user's password when prompted.

    Password: 

    Within the above command:

    • su: Switches users in Linux.
    • -: Loads the user’s environment variables and profile.
  2. List files in the /root directory to verify that a user has sudo privileges.

    CONSOLE
    $ sudo ls /root
    Powered by Vultr AgentBeta

    Enter the sudo user's password when prompted.

    [sudo] password for linuxuser: 

    The command is executed if the user has the sudo privileges, or the sudo action is logged and reported in the system logs if the user does not have sudo privileges.

View User Information in Linux

You can view user information in Linux, including the username, group, and ID information, to use with specific tasks such as changing file permissions. Follow the steps below to view the active user information on your Linux workstation.

  1. Run the whoami command to view the username of the active logged-in user.

    CONSOLE
    $ whoami
    Powered by Vultr AgentBeta

    Verify the active username in your output, similar to the one below.

    linuxuser
  2. Use the groups command to view all groups a user belongs to.

    CONSOLE
    $ groups linuxuser
    Powered by Vultr AgentBeta

    Output:

    linuxuser : linuxuser sudo

    The above group information output confirms that the user linuxuser is a member of the linuxuser and sudo groups.

  3. Run the id command to view the user's default group.

    CONSOLE
    $ id linuxuser
    Powered by Vultr AgentBeta

    The above command displays the user ID (UID), group ID (GID), and the groups the user belongs to. The GID corresponds to the default group.

    uid=1001(linuxuser) gid=1001(linuxuser) groups=1001(linuxuser),27(sudo)

Conclusion

You have created users in Linux. You created regular and sudo users with secure password authentication and verified the user information. Managing Linux users is crucial for maintaining the security and organization of a Linux system. Ensure to use strong passwords and only grant sudo privileges to trusted users to perform administrative tasks such as installing applications on your Linux workstation.

Tags:LinuxNon-root Usersusers

Tech Talk: Running a Self-Improving AI Agent with Hermes on Vultr

Have a suggestion or found an issue with this article?

About the Author

HJ

Hitesh Jethva

View Profile
View Profile

More to Explore

Show More
tech-talk-thumbnail

Tech Talk: Running a Self-Improving AI Agent with Hermes on Vultr

tech-talk-thumbnail

Tech Talk: Implementing Fine-Grained Access Control with Vultr IAM

tech-talk-thumbnail

Tech Talk: Getting Started with Vultr IAM

tech-talk-thumbnail

Tech Talk: Simplifying Zero-Trust Networking with NetBird on Vultr Marketplace

Show More

0 Comments

Start the conversation

Be the first to comment and share your perspective with the community.