Password Policy
Minimum Password Length
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
.
If we want to change the password length, then make the following modifications:
Password Expiration
To easily view the current status of a user account, use the following syntax:
To set any of these values, simply use the following syntax, and follow the interactive prompts:
SSH Access by Disabled Users
They will still be able to gain shell access to the server, without the need for any password. Remember to check the users home directory for files that will allow for this type of authenticated SSH access, e.g. /home/username/.ssh/authorized_keys
.
Restrict SSH access
Restrict SSH access to only user accounts that should have it. For example, you may create a group called “sshlogin” and add the group name as the value associated with the AllowGroups
variable located in the file /etc/ssh/sshd_config
.