Centos7 修改密码策略和用户策略

简介: 在`/etc/login.defs`文件中,配置了邮件存储路径、密码控制策略、UID和GID范围、用户目录创建、umask权限及用户删除选项。密码策略规定:最大使用天数为99999,最小改变间隔为0天,最短长度为5字符,提前7天警告。UID和GID范围设为5000-60000。创建家目录默认开启,umask设为077,且支持删除用户时移除无成员的用户组。

2000元阿里云代金券免费领取,2核4G云服务器仅664元/3年,新老用户都有优惠,立即抢购>>>


阿里云采购季(云主机223元/3年)活动入口:请点击进入>>>,


阿里云学生服务器(9.5元/月)购买入口:请点击进入>>>,

1、vim /etc/login.defs
image.png

image.png

邮件选项

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 Maildir

MAIL_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 99999
PASS_MIN_DAYS 0
PASS_MIN_LEN 5
PASS_WARN_AGE 7

UID起止范围设置,此处最小值被我修改为5000,最大值为60000.

#

Min/max values for automatic uid selection in useradd

#
UID_MIN 5000
UID_MAX 60000

System accounts

SYS_UID_MIN 201
SYS_UID_MAX 999

GID起止范围设置,此处最小值被我修改为5000,最大值为60000.

#

Min/max values for automatic gid selection in groupadd

#
GID_MIN 5000
GID_MAX 60000

System accounts

SYS_GID_MIN 201
SYS_GID_MAX 999

删除用户选项

#

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

umask设置

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.

全部的注解

密码策略相关
PASS_MAX_DAYS 90    # 密码最长过期天数
PASS_MIN_DAYS 80     # 密码最小过期天数
PASS_MIN_LEN 10     # 密码最小长度
PASS_WARN_AGE 7     # 密码过期警告天数

目录
相关文章
|
4天前
|
网络协议 Linux 网络安全
Centos7 防火墙策略rich-rule 限制ip访问-----图文详解
Centos7 防火墙策略rich-rule 限制ip访问-----图文详解
61 0
|
存储 安全 Linux
腾讯云主机安全【等保三级】CentOS7安全基线检查策略
腾讯云主机安全【等保三级】CentOS7安全基线检查策略
629 1
腾讯云主机安全【等保三级】CentOS7安全基线检查策略
|
关系型数据库 MySQL Linux
centos 安装mysql8.0 并修改root密码,解决密码不符合当前策略要求
安装mysql8 和解决修改root密码失败问题
674 0
|
网络协议 安全 Unix
CentOS服务器安全配置策略
CentOS服务器安全配置策略
524 0
CentOS服务器安全配置策略
|
4天前
|
前端开发 jenkins 持续交付
新的centos7.9安装docker版本的jenkins2.436.1最新版本-前端项目发布(五)
新的centos7.9安装docker版本的jenkins2.436.1最新版本-前端项目发布(五)
20 1
|
4天前
|
jenkins 网络安全 持续交付
新的centos7.9安装docker版本的jenkins2.436.1最新版本-后端项目发布(四)
新的centos7.9安装docker版本的jenkins2.436.1最新版本-后端项目发布(四)
18 3
|
4天前
|
网络协议 Linux Docker
在centos7下通过docker 安装onlyoffice
在centos7下通过docker 安装onlyoffice
29 0
|
1天前
|
安全 关系型数据库 MySQL
解决centos7.0安装mysql后出现access defind for user@'localhost'的错误
在使用yum 安装完mariadb, mariadb-server, mariadb-devel后
7 0
|
2天前
|
Linux 网络安全 数据安全/隐私保护
centos7安装gitlab-ce社区版全过程,详细到爆炸,这些面试官常问的开发面试题你都掌握好了吗
centos7安装gitlab-ce社区版全过程,详细到爆炸,这些面试官常问的开发面试题你都掌握好了吗

热门文章

最新文章

http://www.vxiaotou.com