• 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

Configuring Password Inactivity Periods for Users in Linux

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

The useradd command in Linux is used for creating new user accounts. When configuring password inactivity periods using the -f or --inactive INACTIVE option, administrators can set the number of days after a password expires until the account is permanently disabled. This feature helps enforce security policies by automatically locking out inactive accounts after a specified period.

Here are several examples demonstrating the usage of the useradd command with the -f option:

Example 1: Setting an account to be disabled 30 days after password expiration.

    useradd -f 30 username
    

This command creates a new user username and sets the password inactivity period to 30 days. After the password expires, if the user does not change it within 30 days, the account will be disabled.

Example 2: Creating a user with immediate account expiration after password expiration.

    useradd --inactive 0 username2
    

Here, username2 is created with a password inactivity period of 0 days, meaning the account will be disabled immediately after the password expires.

Example 3: Setting a longer inactivity period of 60 days for an account.

    useradd --inactive 60 username3
    

This command assigns a 60-day period after password expiration before the account username3 is disabled due to inactivity.

Example 4: Adding a user with a default inactivity period.

    useradd username4
    

When no -f or --inactive option is specified, the system default inactivity period applies, which may vary based on system configuration.

Verification Steps: To verify if the useradd command with the password inactivity period option was executed correctly, you can use the following steps:

  1. Check if the user account was created by listing all users on the system: cat /etc/passwd | cut -d: -f1.
  2. Inspect the account details, including inactivity settings, in the /etc/shadow file: sudo grep username /etc/shadow.
  3. Confirm the password expiration and inactivity period by examining the user’s account status: sudo chage -l username.
Tags: CommandsLinuxLinux Command TutorialLinux Commands
Previous Post

Setting Expiry Dates for User Accounts in Linux

Next Post

Assigning Primary Group for New 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

Assigning Primary Group for New User Accounts in Linux

howto

Adding Supplementary Groups to User Accounts in Linux

howto

Using Custom Skeleton Directories 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

    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.