码迷,mamicode.com
首页 > 其他好文 > 详细

CentOS7系列--1.3CentOS7用户管理

时间:2018-04-14 18:06:38      阅读:344      评论:0      收藏:0      [点我收藏+]

标签:nobody   ftp   nfs   mysq   hang   inf   word   include   root   

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

CentOS7系列--1.3CentOS7用户管理

标签:nobody   ftp   nfs   mysq   hang   inf   word   include   root   

原文地址:https://www.cnblogs.com/gispathfinder/p/8833046.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!