2 added 951 characters in body
source | link

Setting user Specific password policy:

One option is to modify user password policy - using lchage command.

Below command will set minimum number of days required between pasword changes.

lchage --mindays=<days> <username>

Below command can be used to see current policy

lchage --list <username>

Common Policy for All users:

To set password policy common for all users in system, you need to edit PASS_MIN_DAYS variable in /etc/login.defs file.

root@ubuntu:~# grep PASS_MIN_DAYS /etc/login.defs 
#   PASS_MIN_DAYS   Minimum number of days allowed between password changes.
PASS_MIN_DAYS   1

Above grep listing shows minimum # days required between password changes is 1.

If user tries to reset password before minimum # days set, he/she will get error as listed below.

$ passwd
Changing password for test.
(current) UNIX password: 
You must wait longer to change your password
passwd: Authentication token manipulation error
passwd: password unchanged

While creating user, policy defined in /etc/login.defs will be applicable to user being created. Again lchage --list command can be used to see current policy.

One option is to modify user password policy - using lchage command.

Below command will set minimum number of days required between pasword changes.

lchage --mindays=<days> <username>

Below command can be used to see current policy

lchage --list <username>

Setting user Specific password policy:

One option is to modify user password policy - using lchage command.

Below command will set minimum number of days required between pasword changes.

lchage --mindays=<days> <username>

Below command can be used to see current policy

lchage --list <username>

Common Policy for All users:

To set password policy common for all users in system, you need to edit PASS_MIN_DAYS variable in /etc/login.defs file.

root@ubuntu:~# grep PASS_MIN_DAYS /etc/login.defs 
#   PASS_MIN_DAYS   Minimum number of days allowed between password changes.
PASS_MIN_DAYS   1

Above grep listing shows minimum # days required between password changes is 1.

If user tries to reset password before minimum # days set, he/she will get error as listed below.

$ passwd
Changing password for test.
(current) UNIX password: 
You must wait longer to change your password
passwd: Authentication token manipulation error
passwd: password unchanged

While creating user, policy defined in /etc/login.defs will be applicable to user being created. Again lchage --list command can be used to see current policy.

1
source | link

One option is to modify user password policy - using lchage command.

Below command will set minimum number of days required between pasword changes.

lchage --mindays=<days> <username>

Below command can be used to see current policy

lchage --list <username>