• About Us
  • Privacy & Policy
HowTo's
  • Home
  • Commands
  • Linux
  • SCM
  • Git
  • Database
  • MySQL
  • Kubernetes
  • Docker
No Result
View All Result
  • Home
  • Commands
  • Linux
  • SCM
  • Git
  • Database
  • MySQL
  • Kubernetes
  • Docker
No Result
View All Result
HowTo's
No Result
View All Result
Home Commands

Managing User Accounts with Extra Users Database Command

June 21, 2024
in Commands, Linux, Linux Command Tutorial, Linux Commands
A A
0
12
SHARES
113
VIEWS
Share on FacebookShare on Twitter

The useradd command in Linux is used for creating new user accounts. When using the --extrausers option, it enables management of user accounts with the Extra Users Database Command.

Here are several examples demonstrating the use of useradd --extrausers:

Example 1: Create a new user named ‘testuser’ with extra user database management:
sudo useradd --extrausers testuser
Output (if successful): No output signifies successful user creation.

Verification: To verify if ‘testuser’ was added, use:
grep testuser /etc/passwd
Output: Should display details of ‘testuser’ if successfully added.

Example 2: Add a new user ‘guest’ with specific user ID (UID) and group ID (GID):
sudo useradd --extrausers --uid 2000 --gid 2000 guest
Output (if successful): No output signifies successful user creation.

Verification: Check the entry in the password file:
grep guest /etc/passwd
Output: Should show ‘guest’ with UID 2000 and GID 2000.

Example 3: Create a user ‘developer’ with a specific home directory:
sudo useradd --extrausers --home /home/developer developer
Output (if successful): No output signifies successful user creation.

Verification: Confirm the home directory creation:
ls -ld /home/developer
Output: Should display details of the ‘developer’ home directory.

Example 4: Add a user ‘admin’ with additional comments:
sudo useradd --extrausers --comment "System Administrator" admin
Output (if successful): No output signifies successful user creation.

Verification: Check comments in the password file:
grep admin /etc/passwd
Output: Should show ‘System Administrator’ as the comment for ‘admin’.

Example 5: Create a system user ‘service’ without user interaction:
sudo useradd --extrausers --system service
Output (if successful): No output signifies successful system user creation.

Verification: Verify ‘service’ user with:
grep service /etc/passwd
Output: Should indicate ‘service’ as a system user.

Example 6: Assign a custom shell ‘bash’ to user ‘shelluser’:
sudo useradd --extrausers --shell /bin/bash shelluser
Output (if successful): No output signifies successful user creation.

Verification: Check the shell assignment:
grep shelluser /etc/passwd
Output: Should show ‘/bin/bash’ as the shell for ‘shelluser’.

Example 7: Add a user ‘student’ with an expiration date:
sudo useradd --extrausers --expiredate 2025-12-31 student
Output (if successful): No output signifies successful user creation.

Verification: Check the expiration date setting:
sudo chage -l student
Output: Should display the expiration date for ‘student’.

Example 8: Create a user ‘readonly’ with read-only access:
sudo useradd --extrausers --groups readonly readonly
Output (if successful): No output signifies successful user creation.

Verification: Confirm group membership:
id readonly
Output: Should list ‘readonly’ as a supplementary group for the user.

Example 9: Add a user ‘backup’ with a specific login shell:
sudo useradd --extrausers --shell /bin/false backup
Output (if successful): No output signifies successful user creation.

Verification: Check the shell setting:
grep backup /etc/passwd
Output: Should show ‘/bin/false’ as the shell for ‘backup’.

Example 10: Create a user ‘webadmin’ with a specific UID range:
sudo useradd --extrausers --uid-range 3000-4000 webadmin
Output (if successful): No output signifies successful user creation.

Verification: Verify UID range assignment:
grep webadmin /etc/passwd
Output: Should show ‘webadmin’ with UID within the specified range.

Tags: CommandsLinuxLinux Command TutorialLinux Commands
Previous Post

Using SEUSER for SELinux User Mapping with Useradd Command

Next Post

How to Exclude Bad Names when Creating User Accounts in Linux

Related You may like!

howto

How to Use -iname for Case-Insensitive Filename Searches in find

August 21, 2024
howto

Search for Files with Case-Insensitive Pattern Matching Using -ilname in find

August 21, 2024

Find Files by Group Name with -group in find Command

August 21, 2024

Locate Files by Group ID Using -gid in find Command

August 21, 2024

How to Search for Filesystems with -fstype in find Command

August 21, 2024

Use -false to Test Conditional Expressions in find Command

August 21, 2024
Next Post
howto

How to Exclude Bad Names when Creating User Accounts in Linux

howto

Setting Base Directory for New User Accounts in Linux

howto

Adding Comments to New User Accounts in Linux

Discussion about this post

Latest Updated

howto

How to Use -iname for Case-Insensitive Filename Searches in find

August 21, 2024
howto

Search for Files with Case-Insensitive Pattern Matching Using -ilname in find

August 21, 2024
howto

Find Files by Group Name with -group in find Command

August 21, 2024
howto

Locate Files by Group ID Using -gid in find Command

August 21, 2024
howto

How to Search for Filesystems with -fstype in find Command

August 21, 2024

Trending in Week

  • howto

    Using BTRFS Subvolume for User Home Directory in Linux

    22 shares
    Share 9 Tweet 6
  • Downloading Docker Images from a Registry

    13 shares
    Share 5 Tweet 3
  • Configuring SSL Connection Mode in mysqldump

    17 shares
    Share 7 Tweet 4
  • Omit Tablespace Information in mysqldump Output

    13 shares
    Share 5 Tweet 3
  • Setting MySQL Dump Compatibility Mode

    18 shares
    Share 7 Tweet 5
  • Setting Network Buffer Length in mysqldump

    13 shares
    Share 5 Tweet 3
  • Logging out from Docker Registries

    13 shares
    Share 5 Tweet 3
  • Scheduling Nodes in Kubernetes with kubectl uncordon

    12 shares
    Share 5 Tweet 3
  • Managing Default User Creation Settings in Linux

    15 shares
    Share 6 Tweet 4
  • Using Extended INSERT Syntax in mysqldump

    12 shares
    Share 5 Tweet 3
  • About Us
  • Privacy & Policy

© 2024 All Rights Reserved. Howto.swebtools.com.

No Result
View All Result

© 2024 All Rights Reserved. Howto.swebtools.com.