+
+
clickhouse
bbedit
+
+
+
ray
nuxt
+
+
+
js
+
puppet
junit
+
@
+
+
aws
yaml
+
+
<-
+
+
vite
+
//
k8s
+
+
0b
^
+
scheme
android
backbone
+
arch
quarkus
qdrant
scipy
+
spacy
react
xcode
+
mvn
+
meteor
babel
neo4j
+
+
ubuntu
rb
+
+
c
+
bitbucket
ansible
+
centos
+
+
laravel
+
+
<=
+
+
+=
+
dynamo
+
ubuntu
+
rs
dynamo
+
+
0b
+
+
Back to Blog
How to use useradd command in Linux: Creating and Managing User Accounts
Linux

How to use useradd command in Linux: Creating and Managing User Accounts

Published Nov 15, 2023

Begin your Linux user adventure with the useradd command! 🚀 Crafting and managing accounts is a breeze. 💻✨

4 min read
0 views
Table of Contents

Introduction

The useradd command is a fundamental tool in Linux for creating and managing user accounts. This guide will walk you through the various options and use cases for this essential command.

Basic Syntax

useradd [options] username

Creating a Basic User Account

To create a new user account:

sudo useradd john

Setting User Password

After creating a user, set their password:

sudo passwd john

Specifying User and Group IDs

To create a user with specific UID and GID:

sudo useradd -u 1005 -g 1005 sarah

Creating Home Directory

To create a user with a home directory:

sudo useradd -m -d /home/alice alice

Assigning Login Shell

To specify a login shell for the user:

sudo useradd -s /bin/bash bob

Adding User Information

To add user details like full name:

sudo useradd -c "John Doe" john

Creating System User Accounts

To create a system user account:

sudo useradd -r -s /bin/false systemuser

Adding Users to Groups

To add a user to multiple groups:

sudo useradd -G wheel,docker,developers jane

Conclusion

The useradd command is a powerful tool for Linux user management. With these options, you can create and configure user accounts to meet your specific requirements.