<\/span><\/h2>\nThe changes we’ll be making require you to either be root or have “sudo” permissions. Getting sudo permissions is another discussion altogether. But if you want to switch to root from any other user, just type the following command:<\/span><\/p>\nsu - root<\/span><\/pre>\nEnter your root password and you’re good to go. It’s worth mentioning that performing tasks while logged in as root is almost never a good idea. Get sudo permissions and do what you need to do from there!<\/span><\/p>\n<\/span>Step 2: Checking the Existing Minimum Length<\/span><\/span><\/h2>\nBy default, your current password configuration should already have a minimum length set up. For our installation, this is 8 characters. You can check the validity of any password using the following command:<\/span><\/p>\npwscore<\/span><\/pre>\nHit “Enter” and type your password into the blank line that follows. For example:<\/span><\/p>\n <\/p>\n
In the screenshot above, you can see we’ve entered the password “1234567”. This falls short of the minimum password length of 8, so we get an error message informing us. Of course, this password falls short of many other requirements too. But the minimum length is the first to be checked.<\/span><\/p>\n<\/span>Step 3: Open the pwquality.conf File<\/span><\/span><\/h2>\nAll your password requirements are specified in the following file:<\/span><\/p>\n\/etc\/security\/pwquality.conf<\/span><\/pre>\nAlong with the minimum length, it allows you to assign various degrees of importance to the characteristics of your password. We’ll take a look at those a bit later. For now, just open it using a text editor:<\/span><\/p>\nvi \/etc\/security\/pwquality.conf<\/span><\/pre>\nNow let’s set the minimum length<\/span><\/p>\n<\/span>Step 4: Set the Minimum Password Length<\/span><\/span><\/h2>\nIn the text editor, scroll down till you see this line:<\/span><\/p>\n# minlen = 9\r\n \r\n<\/span><\/pre>\nTo change the minimum length, do these two things:<\/span><\/p>\n\nRemove the hash (#) character from the beginning of the line<\/span><\/li>\nChange the length to your desired length<\/span><\/li>\nChange the following parameters to “0” and Remove the hash (#) for them as well<\/span>\n\ndcredit<\/span><\/li>\nucredit<\/span><\/li>\nlcredit<\/span><\/li>\nocredit<\/span><\/li>\n<\/ol>\n<\/li>\n<\/ol>\nSo if you want the minimum length to be 10, change minlen and the others as shown here:<\/span><\/p>\n <\/p>\n
Save the file.<\/span><\/p>\n<\/span>Step 5: Verify the Changes<\/span><\/span><\/h2>\nNow when we use the “pwscore” command again, the new password length is enforced. Here’s proof:<\/span><\/p>\n <\/p>\n
In this screenshot, we use the password ” qjtdysi7″ – one more than last time. Since we’ve set “minlen” to 10, the minimum password length is now 9.<\/span><\/p>\n<\/span>Step 6 (Optional): Configure Other Password Parameters<\/span><\/span><\/h2>\nIn Step 4, we’ve disabled “credits”, which gives passwords points for things like digits, capital letters, and characters different from the previous password. The default for those was “1”, which means that each time you use one of these characters, the score is added to the length.<\/span><\/p>\nIf we omit Step 4, that it allows users to bypass the minimum length by using a mix of characters and digits. So for example, a “minlen” of 9 could be overcome by the previous password:<\/span><\/p>\nqjtdysi7<\/span><\/pre>\nWhile this has only 8 characters, it contains a digit and lowercase alphabets. Which increases the score to 10 and thus meets our password requirements.<\/span><\/p>\nYou can adjust the “minlen” parameter to a higher number and give people additional points password complexity. You can set the various credits to a negative number to force that specific amount of characters. Do a “dcredit” value of -3 means that the password must have at least 3 digits.<\/span><\/p>\nThe “pwquality.conf” file documents all these parameters, and you can create password rules that are as complex as you like! But here we show you how to get started with a minimum length. You can take it from there!<\/span><\/p>\n \nYou don’t have to enforce\u00a0 password quality on your Linux machine if you are one of our Managed Linux VPS Hosting clients, in which case you can simply ask our technical support to enforce your Linux password for you. They are available 24\/7 and will take care of it asap.<\/p>\n
<\/p>\n","protected":false},"excerpt":{"rendered":"
One of the easiest ways to improve the security of your server is to ensure that everyone’s password meets a … <\/p>\n
Read More<\/a><\/p>\n","protected":false},"author":4,"featured_media":27896,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1703,21],"tags":[27,32],"yoast_head":"\nHow to Enforce Password Quality in Linux - RoseHosting<\/title>\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\t \n\t \n\t \n \n \n \n \n \n\t \n\t \n\t \n