linux最高权限密码,Linux运维知识之15、login.defs(默认)登录和Linux默认权限设置(密码复杂度,相关安全设置)...

本文主要向大家介绍了Linux运维知识之15、login.defs(默认)登录和Linux默认权限设置(密码复杂度,相关安全设置),通过具体的内容向大家展现,希望对大家学习Linux运维知识有所帮助。

[root@www ~]# cat /etc/login.defs

Please note that the parameters in this configuration file control the

behavior of the tools from the shadow-utils component. None of these

tools uses the PAM mechanism, and the utilities that use PAM (such as the

passwd command) should therefore be configured elsewhere. Refer to

/etc/pam.d/system-auth for more information.

#

REQUIRED

Directory where mailboxes reside, or name of file, relative to the

home directory.  If you do define both, MAIL_DIR takes precedence.

QMAIL_DIR is for Qmail

##QMAIL_DIR      MaildirMAIL_DIR        /var/spool/mail#MAIL_FILE      .mail

Password aging controls:

#

PASS_MAX_DAYS   Maximum number of days a password may be used.

PASS_MIN_DAYS   Minimum number of days allowed between password changes.

PASS_MIN_LEN    Minimum acceptable password length.

PASS_WARN_AGE   Number of days warning given before a password expires.

#PASS_MAX_DAYS   99999PASS_MIN_DAYS   0PASS_MIN_LEN    5PASS_WARN_AGE   7

#

Min/max values for automatic uid selection in useradd

#UID_MIN                   500UID_MAX                 60000

#

Min/max values for automatic gid selection in groupadd

#GID_MIN                   500GID_MAX                 60000

#

If defined, this command is 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 is overridden with the -m flag on

useradd command line.

#CREATE_HOME     yes

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

the permission mask will be initialized to 022.

UMASK           077

This enables userdel to remove user groups if no members exist.

#USERGROUPS_ENAB yes

Use SHA512 to encrypt password.

ENCRYPT_METHOD SHA512

在linux,设置密码复杂度的方法有几个

一个是在/etc/login.defs文件,里面几个选项PASS_MAX_DAYS 90 #密码最长过期天数PASS_MIN_DAYS 80 #密码最小过期天数PASS_MIN_LEN 10 #密码最小长度PASS_WARN_AGE 7 #密码过期警告天数

另外一个方法是,修改/etc/pam.d/system-auth文件找到 password requisite pam_cracklib.so这么一行替换成如下:password requisite pam_cracklib.so retry=5 difok=3 minlen=10 ucredit=-1 lcredit=-3 dcredit=-3 dictpath=/usr/share/cracklib/pw_dict不需要在pw_dict后面加.pwd,因为默认会带的[root@front4 ~]# passwd testChanging password for user test.New password: /usr/share/cracklib/pw_dict.pwd.pwd: No such file or directory

参数含义:尝试次数:5 最少不同字符:3 最小密码长度:10 最少大写字母:1 最少小写字母:3 最少数字:3 密码字典:/usr/share/cracklib/pw_dict

这样设置好,你可以做一下测试,不过需要先退出root,因为root用户并不会受这些限制,它可以设置任意的密码。

密码复杂性原则:数字,大写,小写,特殊字符实例如下:

本文由职坐标整理并发布,希望对同学们有所帮助。了解更多详情请关注系统运维Linux频道!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Linux系统中,用户密码复杂度可以通过设置密码策略来实现。密码策略通常包括以下几个方面: 1. 密码长度:密码长度应该设置为足够长,一般建议为8位以上。 2. 复杂度要求:密码应该包含大小写字母、数字和特殊字符等多种类型的字符。 3. 密码历史:系统应该记住之前若干个密码,以免用户反复使用相同的密码。 4. 密码过期:密码应该定期过期,让用户强制更换密码。 在Linux系统中,可以通过修改/etc/login.defs文件来设置密码策略。例如,可以设置密码长度为8位,要求包含数字和特殊字符,并且密码历史为5个密码密码过期时间为90天,可以通过以下命令实现: ``` # 密码长度 PASS_MIN_LEN 8 # 复杂度要求 # dcredit表示数字字符 # ucredit表示大写字母 # lcredit表示小写字母 # ocredit表示特殊字符 # minclass表示至少包含几种字符 # maxrepeat表示不允许重复字符的个数 # maxsequence表示不允许连续字符的个数 # mindiff表示必须与之前密码有几个字符不同 # minlen表示密码长度至少为几个字符 # difok表示是否允许新密码与旧密码相同 # reject_username表示密码不能与用户名相同 # enforce_for_root表示是否强制root用户也要满足密码策略 # 详细说明可以查看man pam_passwdqc PASS_MAX_DAYS 90 PASS_MIN_CLASS_DIGIT 1 PASS_MIN_CLASS_ALPHA 1 PASS_MIN_CLASS_OTHER 1 PASS_MAX_REPEAT_CHARS 2 PASS_MAX_SEQUENCE_CHARS 3 PASS_MIN_DIFF_CHARS 3 PASS_USE_CRACKLIB yes # 密码历史 #表示之前5个密码不能重复使用 PASSWD_HISTORY 5 # 密码过期 # 表示密码过期前30天提醒用户更改密码 PASS_WARN_AGE 30 ``` 设置完成后,需要重启系统或重新加载PAM模块才能使设置生效。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值