How to set a short password on Ubuntu?
Use following command in Terminal:
sudo passwd <user>
Replace <user>
with the username whose password you wish to change.
This works because passwd
suppresses all checks for length or entropy when you use it as the root user.
Warning: if the target user has an encrypted home directory, this will cause problems! (see comments below)
By default, Ubuntu requires a minimum password length of 6 characters, as well as some basic entropy checks. These values are controlled in the file /etc/pam.d/common-password, which is outlined below.
password [success=2 default=ignore] pam_unix.so obscure sha512
If you would like to adjust the minimum length to 4 characters, add the appropriate variable (minlen=4) to the end of the line. The modification is outlined below.
password [success=2 default=ignore] pam_unix.so obscure sha512 minlen=4
Source.
Bring up a terminal and edit /etc/pam.d/common-password
Change this line:
password [success=1 default=ignore] pam_unix.so obscure sha512
to:
password [success=1 default=ignore] pam_unix.so obscure sha512 minlen=4
Password also need a certain amount of complexity, as specified by the obscure parameter above.
password [success=1 default=ignore] pam_unix.so minlen=2 sha512
removes that check also.
This all presupposes that you think this is wise.
See man pam_unix
These work on my system.
To set up a simple password, I tried the simple sudo passwd username
method, but it failed on my Ubuntu Server 12.04 LTS.
So I tried to remove the obscure
option from /etc/pam.d/common-passwd
config file, but it still failed.
So I also removed the obscure
option from /usr/share/pam-configs/unix
config file. And then it worked :-)
I do agree that it should be simplier, when acting as su
to set up a weak password, whatever the reason why one wants to do it! A warning saying "weak password, confirm?" would be perfect...