CentOS7系列--1.3CentOS7用户管理
Posted ParamousGIS
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS7系列--1.3CentOS7用户管理相关的知识,希望对你有一定的参考价值。
CentOS7用户管理
1. 添加用户
[[email protected] ~]# useradd jack
[[email protected] ~]# passwd jack
Changing password for user jack.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.
[[email protected] ~]# exit
2. 切换用户
以新添加的用户登录,然后切换到root账号
login as: jack
[email protected]‘s password:
[[email protected] ~]$ su -
Password:
Last login: Fri Oct 27 06:14:50 CST 2017 from 192.168.1.100 on pts/0
[[email protected] ~]#
3. 将用户作为仅有的可切换到Root的账号
[[email protected] ~]# usermod -G wheel jack
[[email protected] ~]# vi /etc/pam.d/su
#%PAM-1.0
auth sufficient pam_rootok.so
# Uncomment the following line to implicitly trust users in the "wheel" group.
#auth sufficient pam_wheel.so trust use_uid
# Uncomment the following line to require a user to be in the "wheel" group.
auth required pam_wheel.so use_uid
auth substack system-auth
auth include postlogin
account sufficient pam_succeed_if.so uid = 0 use_uid quiet
account include system-auth
password include system-auth
session include system-auth
session include postlogin
session optional pam_xauth.so
4. 将发向 root的邮件转到新创建的用户
[[email protected] ~]# vi /etc/aliases
gdm: root
mailnull: root
postgres: root
sshd: root
smmsp: root
postfix: root
netdump: root
ldap: root
squid: root
ntp: root
mysql: root
desktop: root
rpcuser: root
rpc: root
nfsnobody: root
ingres: root
system: root
toor: root
manager: root
dumper: root
abuse: root
newsadm: news
newsadmin: news
usenet: news
ftpadm: ftp
ftpadmin: ftp
ftp-adm: ftp
ftp-admin: ftp
www: webmaster
webmaster: root
noc: root
security: root
hostmaster: root
info: postmaster
marketing: postmaster
sales: postmaster
support: postmaster
# trap decode to catch security attacks
decode: root
# Person who should get root‘s mail
#root: marc
root: jack
以上是关于CentOS7系列--1.3CentOS7用户管理的主要内容,如果未能解决你的问题,请参考以下文章