您的位置:首页 > 运维架构 > Linux

centos7用户权限设置

2014-12-08 15:48 141 查看
1、 sudo权限添加,编辑修改/etc/sudoers配置文件,在root   ALL=(ALL)     ALL下,添加要加sudo权限的账号。

2、改ssh远程端口:编辑vi
/etc/ssh/sshd_config,找到#Port
22一段,修改为如下:Port 22 ,把Port后的22改成    你要改的端口号(比如8080),然后保存退出,重启sshd服务(systemctl
restart sshd.service)。再在          etc/sysconfig/iptables,中把原来的端口22,改成sshd_config中port的端口号,保存重启iptables服务   (systemctl restart iptables.service)。

3、为了安全,不让root用远程方式登陆系统,编辑#vi /etc/ssh/sshd_config,找到PermitRootLogin
yes,改为        PermitRootLogin no,保存退出,重启sshd服务(systemctl
restart sshd.service)。

4、限制非wheel组用户,不能使用su命令。

   编辑/etc/pam.d/su文件,添加auth            required        /usr/lib64/security/pam_wheel.so   use_uid

                                                     auth            sufficient       /usr/lib64/security/pam_rootok.so  debug

                                                     auth            required       /usr/lib64/security/pam_wheel.so group=wheel

                    (说明:这三个文件的路径是centos7下的,其他版本请自行查找),

       修改/etc/login.defs文件,在最后添加SU_WHEEL_ONLY yes。

    将新添加的普通用户添加的wheel组中,命令usermod -G wheel 用户名。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  centos 安全