• 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

Preventing Home Directory Creation with Useradd Command

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

The useradd command in Unix-like operating systems is used to create new user accounts. One of its options, -M or --no-create-home, prevents the creation of a home directory for the newly added user.

This option is particularly useful in scenarios where you want to add a user account without allocating a home directory. Let’s explore a few examples to understand its usage:

Example 1: Adding a user without creating a home directory.

            useradd -M john_doe
        

This command adds a new user john_doe without creating a home directory.

Example 2: Adding a user with specific options.

            useradd -M -s /bin/bash -c "John Doe" johnd
        

This command adds a user johnd with the specified shell (/bin/bash) and a comment (John Doe), without creating a home directory.

Example 3: Adding a system user.

            useradd -M -r system_user
        

This command adds a system user system_user without creating a home directory.

To verify if the -M option worked as expected, you can check the presence of the home directory. After executing the command, if no home directory is created for the user, it indicates that the option was applied successfully.

Tags: CommandsLinuxLinux Command TutorialLinux Commands
Previous Post

Creating Home Directories Automatically with Useradd Command

Next Post

Managing User and Group Creation with Useradd Command

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

Managing User and Group Creation with Useradd Command

howto

Allowing Non-Unique User IDs with Useradd Command

howto

Setting Passwords for 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

    Dumping BLOBs in Hexadecimal Format with mysqldump

    16 shares
    Share 6 Tweet 4
  • Using BTRFS Subvolume for User Home Directory in Linux

    24 shares
    Share 10 Tweet 6
  • Suppressing CREATE DATABASE Statements in mysqldump

    11 shares
    Share 4 Tweet 3
  • Managing Kubernetes Certificates with kubectl certificate

    20 shares
    Share 8 Tweet 5
  • How to Create and Run a New Container in Kubernetes?

    11 shares
    Share 4 Tweet 3
  • Initializing and Reinitializing Git Repositories

    13 shares
    Share 5 Tweet 3
  • Searching Git Repositories with Grep

    12 shares
    Share 5 Tweet 3
  • Running Docker Images on Kubernetes with kubectl run

    13 shares
    Share 5 Tweet 3
  • Disabling Keys in mysqldump Output

    12 shares
    Share 5 Tweet 3
  • Managing Docker Image Manifests and Lists

    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.