chage Command Tutorial With Examples To Manage User Accounts In Linux

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/chage-command-tutorial-examples-manage-user-accounts-linux/
PINTEREST
PINTEREST
INSTAGRAM

chage is a tool and command used to change user password expiry information in Linux, BSD, Unix systems. With this command we can set password change time, lock status, activity or inactivity of the user account.

Syntax

We will use following syntax for chage command.

Help

Help
Help

Show Password And Related Information For A User

We may want to get detailed password and related information about the user account. This will not list the password of user account. We will use -l or --list options. In this example we will look user account name ismail

Show Password And Related Information For A User
Show Password And Related Information For A User
  • Last password change will show when the password is changed last time
  • Password expires shows when will password expire
  • Password inactive shows when will be password inactive
  • Account expires shows when will account will expire
  • Minimum number of days between password change shows how many day the password will change
  • Maximum number of days between password change shows how many day the password will change
  • Number of days of warning before password expire show how much day before the password expire warning will be shown

Set Password Expiry Date For A User

In order to set user account password expire date we need to have root privileges. We will use -M option to specify number of days to password expire. In this example we will set password expiry date for user ismail to 10 days.

Set Password Expiry Date For A User
Set Password Expiry Date For A User

Set Password Expiry Warning Message

Before the user accounts password expires some warning messages are shown to the user. The time the warning message will be shown is by default 7 days. We can set this warning start days with -W option. In this example we will start showing message before 10 days of password expire for user account ismail

Set Password Expiry Warning Message
Set Password Expiry Warning Message

Set Account Expiry Date

Another useful feature of chage is expiring a user account. Expiring user account will lock the account and can not connect remotely. We will use -E option with a date. This date is in YYYY-MM-DD format. In this example we will set account expire date for user ismail at 2017-05-05 .

LEARN MORE  Base64 and Default Password Projects

Set Account Expiry Date
Set Account Expiry Date

Set Lock Period For In Activity of User

Normally after password is expired the user is forced to change password. What is the user is not trying to change or not login to the system. This shows us an inactivity where user is not active. We can set some security measure if the user is not change his password in specified days. After the period is expired the user account is locked and only root can activate this account. We will use -I option with number of days for inactivity.

Set Lock Period For In Activity of User
Set Lock Period For In Activity of User

Disable Password Aging For User

Some times we do not need any security measure. We only want to run account without any lock, password expiry etc. In this situations we can use previously examined options to disable them.  This will reset all user account related security measures to the default.

Disable Password Aging For User
Disable Password Aging For User

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/chage-command-tutorial-examples-manage-user-accounts-linux/
PINTEREST
PINTEREST
INSTAGRAM