Securing user accounts

In this recipe, we will look at ways to make user profiles more secure.

How to do it...

Follow these steps to secure the user account:

  1. Set a strong password policy with the following steps:
    • Open the /etc/pam.d/common-password file with GNU nano:
      	$ sudo nano /etc/pam.d/common-password
      
    • Find the line similar to this:
      password    [success=1 default=ignore]  pam_unix.so obscure sha512
      
    • Add minlen to the end of this line:
      password    [success=1 default=ignore]  pam_unix.so obscure sha512 minlen=8
    • Add this line to enforce alphanumeric passwords:
      password requisite pam_cracklib.so ucredit=-1 lcredit=-1 dcredit=-1  ocredit=-1
      
    • Save changes and exit GNU nano editor.
    • Press Ctrl + O to save changes.
    • Press Ctrl + X to exit GNU nano editor.
  2. Secure the ...

Get Ubuntu Server Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.