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

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

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     # 密码过期警告天数

目录
相关文章
|
5月前
|
网络协议 Linux 网络安全
Centos7 防火墙策略rich-rule 限制ip访问-----图文详解
Centos7 防火墙策略rich-rule 限制ip访问-----图文详解
734 0
|
存储 安全 Linux
腾讯云主机安全【等保三级】CentOS7安全基线检查策略
腾讯云主机安全【等保三级】CentOS7安全基线检查策略
749 1
腾讯云主机安全【等保三级】CentOS7安全基线检查策略
|
关系型数据库 MySQL Linux
centos 安装mysql8.0 并修改root密码,解决密码不符合当前策略要求
安装mysql8 和解决修改root密码失败问题
766 0
|
网络协议 安全 Unix
CentOS服务器安全配置策略
CentOS服务器安全配置策略
552 0
CentOS服务器安全配置策略
|
10天前
|
Linux 网络安全 Python
linux centos上安装python3.11.x详细完整教程
这篇文章提供了在CentOS系统上安装Python 3.11.x版本的详细步骤,包括下载、解压、安装依赖、编译配置、解决常见错误以及版本验证。
80 1
linux centos上安装python3.11.x详细完整教程
|
8天前
|
Unix Linux 开发工具
centos的官网下载和vm16虚拟机安装centos8【保姆级教程图解】
本文详细介绍了如何在官网下载CentOS 8以及在VMware Workstation Pro 16虚拟机上安装CentOS 8的步骤,包括可能出现的问题和解决方案,如vcpu-0错误的处理方法。
centos的官网下载和vm16虚拟机安装centos8【保姆级教程图解】
|
9天前
|
消息中间件 Linux
centos7安装rabbitmq
centos7安装rabbitmq
|
8天前
|
Linux 虚拟化 Windows
完美解决:重新安装VMware Tools灰色。以及共享文件夹的创建(centos8)
这篇文章提供了解决VMware Tools无法重新安装(显示为灰色)问题的步骤,并介绍了如何在CentOS 8上创建和配置VMware共享文件夹。
完美解决:重新安装VMware Tools灰色。以及共享文件夹的创建(centos8)
|
9天前
|
Docker 容器
centos7.3之安装docker
centos7.3之安装docker
下一篇
无影云桌面