+
+
oauth
%
neo4j
+
+
c++
+
::
remix
s3
+
haskell
mongo
!==
go
+
⊂
aws
+
bun
flask
solidity
--
r
k8s
lisp
+
+
+
stimulus
+
firebase
+
+
d
alpine
+
+
...
gitlab
+
prettier
+
+
ubuntu
...
+
bundler
fortran
+
+
+
+
pycharm
+
+
+
clion
vault
+
+
py
gradle
+
yarn
+
ray
rollup
+
centos
+
graphql
+
nomad
strapi
haskell
websocket
fauna
php
sinatra
+
+
+
git
unix
clj
emacs
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.