Learning

Linux for Starters: Your Guide to Linux – Managing Users – Part 15

Last Updated on May 22, 2022

Create a new user with the command-line

From the command-line, a new user is created using the adduser command. You need elevated privileges to create a user (the user running the command needs to be a member of the sudo group or logged in as root). Here’s an example command:

$ sudo useradd -m joshua

The -m flag gives the new user, joshua, their own home directory, /home/joshua/, which is populated with three hidden files (.bash_logout, .bashrc, and .profile).

We can define the new user’s password with the command:

$ sudo passwd joshua

Enter the password when prompted.

In some cases, it will be useful to add a user to a group (other than their default “main” group) in order to grant them additional permissions. For example, a user who is included in the cdrom group can access CD/DVD and other optical devices. Let’s create a user (ken) with additional permissions.

$ sudo useradd -mG cdrom ken

And give that new user a password in the same way as before:

$ sudo passwd ken

Enter the password when prompted.


We hope this introduction for creating users is useful.

Pages in this article:
Page 1 – Groups
Page 2 – Create a new user with the GUI
Page 3 – Create a new user with the command-line


All articles in this series:

Linux For Starters: Your Guide to Linux
1What is Linux? Why use Linux? What do I need?
2Choose a Linux distribution meeting your specific needs and requirements.
3Make a bootable Ubuntu USB stick in Windows.
4We show you how to install Ubuntu 21.04 on your hard disk.
5Things to do after installing Ubuntu.
6Navigating your way around the Desktop.
7Updating the system, install new software.
8Open source replacements for proprietary Windows desktop software.
9Get started with the power and flexibility of the terminal.
10We cover the basics of files and permissions.
11Getting help from your system.
12Learn all about the file system.
13Manipulating files from the shell.
14Maintain your system with these simple tips.
15Managing users on your system.
16Explore different desktops to GNOME 3.
17Gaming on Linux.
18Protect your privacy with this guide.
19Access the Windows desktop from Linux using a remote desktop client.
20Set up a virtual machine running Ubuntu as the host and openSUSE as the guest.
21Wine lets you run Windows programs on Linux without emulation.
22Extend your GNOME desktop with extensions and themes.
XUseful Linux commands.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Please read our FAQ before making a comment.

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments