CentOS7系列--1.3CentOS7用户管理

CentOS7用户管理

1. 添加用户

[root@centos7 ~]# useradd jack

[root@centos7 ~]# 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.

[root@centos7 ~]# exit

2. 切换用户

以新添加的用户登录,然后切换到root账号

login as: jack

jack@192.168.1.101's password:

[jack@centos7 ~]$ su -

Password:

Last login: Fri Oct 27 06:14:50 CST 2017 from 192.168.1.100 on pts/0

[root@centos7 ~]#

3. 将用户作为仅有的可切换到Root的账号

[root@centos7 ~]# usermod -G wheel jack

[root@centos7 ~]# 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的邮件转到新创建的用户

[root@centos7 ~]# 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

转载于:https://www.cnblogs.com/gispathfinder/p/8833046.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值