A detailed description of the secret login.defs files for Linux users

Source: Internet
Author: User

We all know that Linux has a lot of users, there are super administrator users, there are ordinary users, there are a lot of system users.

So the question is, how are these users generated? What are the rules that determine the attributes of these users? So, let me take you into Linux, uncover its mystery!

Anyone who has contacted Linux knows that creating a user requires a simple command: "Useradd + username" can successfully create a Linux normal user, "passwd + username" can set a password for the user.

[Email protected] ~]# Useradd Liupengfang

[Email protected] ~]# passwd Liupengfang

Change the password for the user Liupengfang.

New Password:

Re-enter the new password:

PASSWD: All the authentication tokens have been successfully updated.

Once created, we can use the ID command to view the user's ID:

[[email protected] ~]# ID Liupengfang

uid=4005 (Liupengfang) gid=4005(Liupengfang) group =4005 (Liupengfang)

You can also view the user's home directory under the/a directory:

[Email protected] ~]# cd/home/

[[email protected] home]# ls

Fedora Fedora Liupengfang Mandriva

We will see that the UID for user Liupengfang is 4005,gid and 4005. Why are these IDs not starting from 1? Why do I create a home directory in the/House directory after the user is created? Will these users expire? This requires us to understand a file------login.defs.

We look at this file:

[Email protected] home]# vim/etc/login.defs

Pass_max_days 99999 #密码最长过期时间

Pass_min_days 0 #密码最短过期时间

Pass_min_len 5 #密码最小长度

Pass_warn_age 7 #密码过期提前提醒时间


#

# Min/max values for automatic uid selection in Useradd

#

Uid_min #uid最小值

Uid_max 60000 #uid最大值


#

# Min/max values for automatic gid selection in Groupadd

#

Gid_min #gid最小值

Gid_max 60000 #gid最小值


#

# If defined, this command was run when removing a user.

# It should remove any at/cron/print jobs etc. owned by

# The user to be removed (passed as the first argument).

#

#USERDEL_CMD/usr/sbin/userdel_local


#

# If Useradd should create home directories for users by default

# on RH systems, we do. This option was overridden with THE-M flag O

N

# useradd command line.

#

Create_home Yes #是否同时建立家目录


# The permission mask is initialized to this value. If not specified

,

# The permission mask is initialized to 022.

UMASK 077 #创建后用户的权限掩码


# This enables Userdel to remove the user groups if no members exist.

#

Usergroups_enab Yes #创建用户时是否同时创建相同用户名的组


# Use SHA512 to encrypt password.

Encrypt_method SHA512 #密码加密方式为SHA512

After reading this configuration file, we will get a general understanding of why the user created its properties are actually substantiated, login.defs this file is used to set user-created properties of the file. Of course, these properties are not fixed, we can use Usermod + parameters to change its various properties, and these parameters as long as the man will know.


This article is from the IT Network blog, so be sure to keep this source http://liupengfang1015.blog.51cto.com/6627801/1662534

A detailed description of the secret login.defs files for Linux users

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.