前端之家收集整理的这篇文章主要介绍了
CentOS 7安装完成后基本配置,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
1、添加用户
新增名为"wang"的用户
[root@vdevops ~]# useradd wang #添加账户
[root@vdevops ~]# passwd wang #设置密码
Changing password for user wang.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[root@vdevops ~]# exit #退出
以用户"wang"为例,设置其为唯一拥有管理员权限的账户
[root@vdevops ~]# usermod -G wheel wang
[root@vdevops ~]# vim /etc/pam.d/su
- #%PAM-1.0
- authsufficientpam_rootok.so
- #Uncommentthefollowinglinetoimplicitlytrustusersinthe"wheel"group.
- #authsufficientpam_wheel.sotrustuse_uid
- #Uncommentthefollowinglinetorequireausertobeinthe"wheel"group.
- #取消下面一行的注释
- authrequiredpam_wheel.souse_uid
- authsubstacksystem-auth
- authincludepostlogin
- accountsufficientpam_succeed_if.souid=0use_uidquiet
- accountincludesystem-auth
- passwordincludesystem-auth
- sessionincludesystem-auth
- sessionincludepostlogin
- sessionoptionalpam_xauth.so
设置root账户的邮件转发
# Person who should get root's mail
# 最后一行,取消注释,改变用户名称
root: wang
2、设置防火墙和SELINUX
【1】防火墙
查看防火墙状态
copy
[root@vdevops~]#systemctlstatusfirewalld
●firewalld.service-firewalld-dynamicfirewalldaemon
Loaded:loaded(/usr/lib/systemd/system/firewalld.service;enabled;vendorpreset:enabled)
Active:active(running)sinceWed2016-10-2601:09:49CST;1h36minago
MainPID:744(firewalld)
CGroup:/system.slice/firewalld.service
└─744/usr/bin/python-Es/usr/sbin/firewalld--nofork--nopid
Oct2601:09:46vdevops.comsystemd[1]:Startingfirewalld-dynamicfirewalldaemon...
Oct2601:09:49vdevops.comsystemd[1]:Startedfirewalld-dynamicfirewalldaemon.