Linux Etc Login.defs配置示例

Linux shadow password suite provides password related utils and configuration. /etc/login.defs or simple login.defs provides configuration about shadow utils. This file provides password, mail, user id, group id, user home related configuration. We will look all of the useful configurations in this tutorial.

Linux影子密码套件提供了与密码相关的utils和配置。 /etc/login.defs或简单的login.defs提供有关影子工具的配置。 该文件提供密码,邮件,用户ID,组ID,与用户家庭相关的配置。 我们将在本教程中查找所有有用的配置。

Login.defs配置文件 (Login.defs Configuration File)

login.defs configuration file is located at /etc/login.defs . It is simple text file. We can use any text editor to edit and change values. In this tutorial we will use vim . More information about vim can be get from following tutorial.

login.defs配置文件位于/etc/login.defs 。 这是简单的文本文件。 我们可以使用任何文本编辑器来编辑和更改值。 在本教程中,我们将使用vim 。 有关vim更多信息可以从以下教程中获得。

http://www.poftut.com/linux-vi-vim-command-line-text-editor-tutorial/

http://www.poftut.com/linux-vi-vim-command-line-text-editor-tutorial/

设置最大密码天数 (Set Maximum Password Days)

We can use PASS_MAX_DAYS to limit password usage days. After specified time user should change his password. The default value for PASS_MAX_DAYS is 99999 . In this example we set 100 days for password expire.

我们可以使用PASS_MAX_DAYS来限制密码使用天数。 在指定的时间之后,用户应更改其密码。 PASS_MAX_DAYS的默认值为99999。 在此示例中,我们将密码过期设置为100天。

PASS_MAX_DAYS 100

设置最小密码天数 (Set Minimum Password Days)

We can use PASS_MIN_DAYS to limit minimum days a password can be used. Before specified time user can not change his password. The default value for PASS_MIN_DAYS is 0 which means this configuration is disabled . In this example we will set PASS_MIN_DAYS to 30 days.

我们可以使用PASS_MIN_DAYS来限制可以使用密码的最短日期。 在指定时间之前,用户无法更改密码。 PASS_MIN_DAYS的默认值为0,这表示此配置已禁用。 在此示例中,我们将PASS_MIN_DAYS设置为30天。

PASS_MIN_DAYS 30

设置密码警告日 (Set Warning Days For Password)

We can use PASS_WARN_AGE to set the days to worn before password expiry. The default value for PASS_WARN_AGE is 7 days. In this example we will set to 5 days.

我们可以使用PASS_WARN_AGE设置密码到期前的佩戴天数。 PASS_WARN_AGE的默认值为7天。 在此示例中,我们将设置为5天。

PASS_WARN_AGE 5

设置密码最小长度 (Set Password Minimum Length)

Password is important part of the security. Brute force attacks can reveal weak or not enough strong password easily. By using PASS_MIN_LEN we can specify the minimum length of the passwords about user accounts. The default minimum length for password in Linux is 5 . In this example we will change to 10 .

密码是安全性的重要组成部分。 蛮力攻击可以轻易揭示出弱密码或强度不足的密码。 通过使用PASS_MIN_LEN我们可以指定有关用户帐户的密码的最小长度。 在Linux中,密码的默认最小长度为5 。 在此示例中,我们将更改为10

PASS_MIN_LEN 10

Following tutorial provides how to check user account password strength for more security.

以下教程提供了如何检查用户帐户密码强度以提高安全性。

http://www.poftut.com/check-password-strength-linux-cracklib/

http://www.poftut.com/check-password-strength-linux-cracklib/

LEARN MORE  How To Crack Password John The Ripper with Wordlist
了解更多信息如何用单词表破解密码

设置邮箱目录(Set Mailbox Directory)

We can use MAIL_DIR configuration to set users mail directory. The default directory for mails in Linux is /var/spool/mail . In this example we will change mail directory of users to /var/spool

我们可以使用MAIL_DIR配置来设置用户的邮件目录。 Linux中邮件的默认目录为/var/spool/mail 。 在此示例中,我们将用户的邮件目录更改为/var/spool

MAIL_DIR /var/spool/mail

设置普通用户ID的开始 (Set Start Of Normal User ID’s)

Every normal user account in Linux have id to uniquely identification. The start value of user id’s can be specified with UID_MIN option. Default user id start number in Linux is 1000 . In this example we set start of user id to 2000 .

Linux中的每个普通用户帐户都具有用于唯一标识的ID。 可以使用UID_MIN选项指定用户ID的起始值。 在Linux中,默认的用户ID起始编号为1000 。 在此示例中,我们将用户ID的开始设置为2000

UID_MIN 2000

设置系统用户ID的开始 (Set Start Of System User ID’s)

Systems users in Linux are used with system binaries, daemon or services. We can define the system user start id with SYS_UID_MAX . The default value for start number of system user id is 201 . In this example we will change to 300 .

Linux中的系统用户与系统二进制文件,守护程序或服务一起使用。 我们可以使用SYS_UID_MAX定义系统用户的起始ID。 系统用户ID的起始编号的默认值为201。 在此示例中,我们将更改为300。

SYS_UID_MIN 300

设置普通组ID的开始 (Set Start Of Normal Group ID’s)

In Linux groups have id’s too because they are used in permission system and relation. We can use GID_MIN to specify start of group id numbers. The default start value for group id is 1000 . In this example we will start start value for group id to 1500 .

在Linux中,组也具有ID,因为它们用于权限系统和关系中。 我们可以使用GID_MIN指定组ID编号的开始。 组ID的默认起始值​​为1000。 在此示例中,我们将组ID的起始值从1500开始。

GID_MIN 1500

设置系统组ID的开始 (Set Start Of System Group ID’s)

System groups are used like system users. Their start id’s are specified with SYS_GID_MIN . The default value for SYS_GID_MIN is 201 . In this example we will change to 301.

系统组的使用类似于系统用户。 它们的起始ID由SYS_GID_MIN指定。 SYS_GID_MIN的默认值为201。 在此示例中,我们将更改为301。

SYS_GID_MIN 201

启用和禁用用户家庭创建 (Enable and Disable User Home Creation)

Linux user generally have home directories to store their personal and private data. The user home directories resides /home/ and the user name. This user home directory is automatically created at user creation. We can change this behaviour with CREATE_HOME option. The default is yes

Linux用户通常具有主目录来存储其个人和私有数据。 用户主目录位于/home/和用户名。 该用户主目录是在用户创建时自动创建的。 我们可以使用CREATE_HOME选项更改此行为。 默认yes

CREATE_HOME  yes

but we can disable user home creation with no like below.

但我们可以停用家创作no像下面。

CREATE_HOME no

设置Umask (Set Umask)

Umask value is used to set newly created files and folders permissions. We can change the default Umask value with UMASK configuration. The default value for umask is 077 .In this example we set umask 055 .

Umask值用于设置新创建的文件和文件夹权限。 我们可以使用UMASK配置更改默认的Umask值。 umask的默认值为077在本示例中,我们将umask设置为055

UMASK 055

设置影子文件用户密码加密算法 (Set Shadow File User Password Encryption Algorithm)

User passwords are stored in /etc/shadow file in Linux operating systems. Storing them in clear text is critical security problem and so all passwords are stored in encrypted mode. The default encryption algorithm is SHA512 . We can change this algorithm with ENCRYPT_METHOD option. In this example we will change to SHA256 .

用户密码存储在Linux操作系统的/etc/shadow文件中。 以明文形式存储它们是关键的安全问题,因此所有密码均以加密模式存储。 默认的加密算法是SHA512。 我们可以使用ENCRYPT_METHOD选项更改此算法。 在此示例中,我们将更改为SHA256

ENCRYPT_METHOD SHA256

翻译自: https://www.poftut.com/linux-etc-login-defs-configuration-examples/

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值