Change minimum password length in Ubuntu. How to set password length in Ubuntu Linux and change the minimum password length in Ubuntu 15.10, Ubuntu 15.04, Ubuntu 14.04, Ubuntu 14.10 and Derivatives.
By default, Ubuntu requires a minimum password length of 6 characters, as well as some basic entropy checks. These password values are controlled and stored in the file /etc/pam.d/common-password. Look below.
password [success=1 default=ignore] pam_unix.so obscure sha512
If you would like to adjust the minimum length to 8 characters, change the appropriate variable to min=8. The modification is outlined below.
password [success=1 default=ignore] pam_unix.so obscure sha512 minlen=8
Please note that the basic password entropy checks and minimum length rules do not apply to the administrator using sudo level commands to setup a new user.
Steps To Change Minimum Password Length
1. Open Terminal and launch “/etc/pam.d/common-password” file by running the below command to edit the file:
$ sudo nano /etc/pam.d/common-password
2. The file will open in the Terminal screen. Scroll down and find out the line which says “password [success=1 default=ignore] pam_unix.so obscure sha512.”
- To set the minimum password length, add minlen=N (N is a number) to the end of this line after “sha512”.
- To disable complexity check, delete and remove “obscure” from the above line.
3. Once done, press Ctrl+X and type Y to save changes and press Enter to exit.
- Type passwd command as follows to change your own password:
$ passwd
- To change password for other user account, login as root user and type the following command to change password for user:
$ passwd USERNAME
You will be prompted to enter your old password for verification, and then a new password.