Linux How To Set Password Rules and Policies

Liv4IT
7 Mar 201707:47

Summary

TLDRThis Linux tutorial demonstrates how to set password rules for user accounts on a Linux system. The video starts by creating a user with a simple '123' password, then moves on to installing the 'libpam-pwquality' library to enforce stronger passwords. It guides viewers through editing the '/etc/pam.d/common-password' file to set minimum password length, require uppercase letters, lowercase letters, digits, and special characters. The tutorial shows how to apply these rules by attempting to change a user's password, illustrating the enforcement of the newly set criteria.

Takeaways

  • 😀 The tutorial demonstrates how to set password rules in Linux to enhance security.
  • 🛠️ The 'adduser' command is used to create a new user in Linux, but it allows weak passwords by default.
  • 🔒 To enforce stronger passwords, a password quality check library must be installed, such as 'libpam-pwquality'.
  • 📚 The '/etc/pam.d/common-password' file is where password rules can be configured in Debian-based systems.
  • ✏️ Editing the 'common-password' file with root privileges allows setting various password requirements.
  • 🔡 The minimum password length can be set by adding 'minlen' followed by the desired number of characters.
  • 🔑 The 'ucredit', 'lcredit', 'dcredit', and 'ocredit' options can be used to enforce the inclusion of uppercase letters, lowercase letters, digits, and special characters, respectively.
  • 🚫 The script shows that passwords not meeting the new rules will be rejected, prompting users to create stronger passwords.
  • 🔄 After making changes to the 'common-password' file, the system will reflect these rules for new passwords.
  • 🔄 The tutorial suggests that users can experiment with different options to create a customized set of password rules.
  • 🙏 The presenter expresses gratitude for viewing the tutorial and hopes it was informative.

Q & A

  • What is the purpose of the tutorial?

    -The purpose of the tutorial is to demonstrate how to set password rules in Linux to enhance security by adding complexity to user passwords.

  • What command is used to create a new user in Linux?

    -The command used to create a new user in Linux is 'adduser', which should be executed with root privileges.

  • Why is the initial password '1 2 3' considered weak?

    -The initial password '1 2 3' is considered weak because it lacks complexity, being a simple sequence of numbers without any uppercase, lowercase, or special characters.

  • What is the 'libpam-pwquality' package and why is it needed?

    -The 'libpam-pwquality' package is a password quality check library used in Linux to enforce password rules. It is needed to set up and enforce password policies.

  • How can you install the 'libpam-pwquality' package on a Debian-based system?

    -You can install the 'libpam-pwquality' package on a Debian-based system using the command 'apt-get install libpam-pwquality' with updates.

  • What file needs to be edited to set password rules in Linux?

    -The file that needs to be edited to set password rules in Linux is '/etc/pam.d/common-password'.

  • What does the 'minlen' option do in the password rules configuration?

    -The 'minlen' option in the password rules configuration sets the minimum length requirement for passwords.

  • How can you enforce a password to have at least one uppercase character?

    -To enforce a password to have at least one uppercase character, you can add the option 'ucredit=-1' to the configuration line in the 'common-password' file.

  • What does the 'lcredit' option represent in the password rules?

    -The 'lcredit' option in the password rules represents the requirement for lowercase characters in a password.

  • How can you require a password to have at least one digit?

    -To require a password to have at least one digit, you can replace 'lcredit' with 'dcredit' and set it to '-1' in the configuration line.

  • What is the effect of adding 'ocredit=-1' to the password rules?

    -Adding 'ocredit=-1' to the password rules enforces the requirement for at least one special character in the password.

Outlines

00:00

🛠️ Setting Password Rules in Linux

This paragraph introduces a Linux tutorial focused on establishing password rules for user accounts. The speaker demonstrates creating a user named 'gems' with a weak password ('1 2 3') and then discusses the necessity of a password quality check library. They proceed to install this library on a Debian distribution using the command 'apt-get install libpam-pwquality'. The goal is to enhance password security by setting rules within the '/etc/pam.d/common-password' file, starting with a minimum password length of 12 characters.

05:02

🔒 Enhancing Password Complexity in Linux

The second paragraph delves deeper into customizing password rules by editing the '/etc/pam.d/common-password' file. The speaker outlines how to enforce a password to include at least one uppercase letter by adding 'retry=3 minlen=12 difok=1 ucredit=-1' to the configuration line. They also explain how to require lowercase letters and digits, using 'lcredit' and 'dcredit' options respectively. Additionally, the speaker shows how to mandate the inclusion of special characters by setting 'ocredit=-1'. The paragraph concludes with a reminder to save changes and observe their effects on new user password requirements.

Mindmap

Keywords

💡Linux

Linux is a family of open-source Unix-like operating systems. In the video, the theme revolves around setting password rules within a Linux environment, demonstrating its use for system administration and security purposes.

💡Password Rules

Password rules are the criteria that a password must meet to be considered valid, often including length, complexity, and character diversity. The video focuses on how to set these rules in Linux to enhance account security.

💡User Creation

The process of adding a new user to a system is referred to as user creation. In the script, the command 'add user' is used to create a new user named 'gems', illustrating the initial step before setting password rules.

💡Root Privileges

Root privileges refer to the highest level of access within a Linux system, equivalent to an administrator's rights. The script mentions using root privileges to add a user and change password rules, emphasizing the importance of administrative access for system configuration.

💡Password Quality Check Library

This is a software component used to enforce password policies. The video script describes installing this library to enable the setting of password rules, indicating its necessity for implementing stronger password requirements.

💡Debian Distribution

Debian is a popular Linux distribution known for its stability and security. The script specifies using 'apt-get install', a package handling utility in Debian-based systems, to install the password quality check library.

💡/etc/pam.d

The /etc/pam.d directory contains configuration files for the Pluggable Authentication Modules (PAM) system in Linux. The script mentions navigating to this directory to open and edit the 'common-password' file, which is central to setting password rules.

💡Minimum Length

Minimum length is a common password rule that specifies the shortest acceptable password length. The video demonstrates setting this to 12 characters as an example of a password rule within the 'common-password' file.

💡Uppercase Letters

Requiring at least one uppercase letter in a password is a way to increase its complexity. The script shows how to modify the password rule to enforce this requirement, enhancing password strength.

💡Special Characters

Including special characters in a password adds an extra layer of complexity. The video explains how to set a rule that mandates the inclusion of at least one special character to improve password security.

💡Numerical Values

Numerical values refer to digits used in passwords. The script includes setting a rule that requires at least one digit to be part of the password, which is another common practice to increase password complexity.

Highlights

Introduction to setting password rules in Linux.

Creating a user with the 'adduser' command and setting a weak password.

The importance of password complexity and security.

Installing the 'libpam-pwquality' library for password quality checks.

Accessing the '/etc/pam.d' directory to modify password rules.

Editing the 'common-password' file to set minimum password length.

Setting a minimum password length of 12 characters.

Demonstration of attempting to change a password with less than the required length.

Adding a rule to require at least one uppercase character in the password.

Receiving an error message for not meeting the new password requirements.

Modifying rules to include at least one lowercase character.

Adding a requirement for at least one digit in the password.

Including a special character as part of the password requirements.

Customizing password rules with multiple options for enhanced security.

The necessity of saving changes to reflect new password rules.

Conclusion and thanks for viewing the tutorial.

Transcripts

play00:00

hello youtube and welcome to another

play00:02

Linux tutorial so today I'm going to

play00:05

show you how to set password rules in

play00:08

Linux so are you ready let's get started

play00:13

so let's say for example you want to

play00:16

create a user

play00:17

so here I'll use the command add user

play00:20

with root privileges so add user and

play00:26

let's call it for example gems so here

play00:29

I'm adding the user called gems so as

play00:36

you can see it's asking me for a

play00:38

password so here actually I can put

play00:42

whenever password I want whenever land

play00:46

whenever it's upper case or lower case

play00:49

or anyone or anything I want so for

play00:52

example I can just enter 1 2 3

play00:55

and retype it 1 2 3 and it will accept

play00:59

it

play01:03

so the user gems has been created using

play01:07

just password which is a very weak

play01:09

password one two three so let's say that

play01:12

we want to change the rule we want to

play01:15

add more functionality more complexity

play01:18

to these passwords so in order to do

play01:21

that the first thing is to make sure

play01:23

that you have installed what we call a

play01:26

password quality check library so I will

play01:29

install it with updates because I'm

play01:34

using a Debian distribution here

play01:36

applicate install then the lip ban -

play01:45

quality check actually password quality

play01:52

so this is the the level that they

play01:56

should have be installed

play02:00

and I hit enter

play02:04

so it's to see if the library is distort

play02:07

on that

play02:08

and if not it will be solid so this is

play02:12

the first step in order to set up rules

play02:15

okay so now the library is installed now

play02:20

I must go to specific actually five and

play02:24

open it so like I can add my rules so I

play02:29

will go to a directory called slash etc

play02:34

slash Bam dot d okay so if I do list

play02:43

here I can see a bunch of files okay but

play02:51

there is a very interesting file that I

play02:53

am going to change in order to set up my

play02:55

rules which called common password as

play02:58

you can see here so in order to edit

play03:01

this file I should have read privileges

play03:04

so I will just open it using the root

play03:07

privileges within it editor I want here

play03:10

I want to use for example Nano

play03:13

and I'm gonna open this file which is

play03:17

common password so as you can see here

play03:21

it is very simple file

play03:24

so let's say for example that we want to

play03:27

set the minimum land of the passwords to

play03:32

12 characters so I'll go to this line

play03:35

here and just at the end I'll add space

play03:40

and our right men men land take all to

play03:48

whenever length I want for example here

play03:50

I want to set it to 12 okay

play03:53

so save my file control x2 yes and hit

play04:00

enter

play04:00

so now let's change the password for the

play04:04

user chaps so the current for that case

play04:08

password

play04:09

[Music]

play04:11

and the name of my user which is temps

play04:15

so here it asking me the new password so

play04:19

let's give it just for example four

play04:24

characters and I hit enter as you can

play04:27

see now it telling me it's a bad

play04:30

password because we have set up the land

play04:32

for 12 characters just exit

play04:40

so I would open once again by five and

play04:44

this time let's say for example that our

play04:48

password must have at least one new per

play04:52

character so I can add to the same line

play04:58

new parameter I can delete this one so

play05:01

let's say that we the lead is not

play05:04

interesting so in order your password to

play05:07

have at least one

play05:11

yooper case we have to add option you

play05:14

credit equal to minus one okay so now

play05:22

the password must have at least one you

play05:25

per characters all save yes and hit

play05:30

enter and simply English changes so

play05:35

let's just enter some characters so as

play05:39

you can see now it gave me the message

play05:42

that the password must contain at least

play05:44

one upper case letter okay so just

play05:51

accept over to the my file so you can

play05:55

add many options that you want your line

play05:59

here so for example if you want that

play06:03

password contains at least one lowercase

play06:07

character see how just to replace to you

play06:11

with el el credit and always integral

play06:16

minus one okay if you want your password

play06:20

to have actually at least one digit so

play06:25

one numerical value so you press the you

play06:28

can replace the L by D default digit so

play06:34

this time your password must have must

play06:37

have at least one numerical value

play06:41

if you want I can add money option for

play06:45

example I want my password to have at

play06:47

least one digit and at least one special

play06:51

character so I can add other character

play06:54

with opportunity or credit equal -1 ok

play07:02

so in this case my password must have at

play07:05

least one numerical value one digit and

play07:09

plus one special character so you can

play07:14

play with this option as many times as

play07:16

you want in order to set up rules for

play07:19

your passwords ok but always you have to

play07:24

save the file and you will see that the

play07:27

changes that you have made to this file

play07:29

actually are reflected to the new

play07:33

password that you must create for your

play07:35

new users as always I hope it has been

play07:39

informative for you and I want to thank

play07:42

you for viewing but I

Rate This

5.0 / 5 (0 votes)

Ähnliche Tags
Linux TutorialPassword RulesSecurity TipsUser CreationPassword StrengthRoot PrivilegesDebian InstallPam.d ConfigPassword PolicySecurity Enhancement
Benötigen Sie eine Zusammenfassung auf Englisch?