centos7为用户添加root权限

来源:互联网 发布:js中怎么格式化日期 编辑:程序博客网 时间:2024/05/16 01:35

1.  useradd sha

      passwd sha   创建用户及密码

2. 一、gpasswd -a sha wheel   赋予  sha   root权限

    二、 vi /etc/sudoers

        Allow root to run any commands anywhere
        root    ALL=(ALL)       ALL    #原有行
        sha     ALL=(ALL)       ALL   #添加此行

       保存后   登陆sha用户    使用   sudo   即可

    三、vi /etc/sudoers

        ## Allows people in group wheel to run all commands
         %wheel  ALL=(ALL)       ALL      #找到此行  如果前面有   #    删掉#后保存

        执行  usermod -g root sha 

       登陆sha   使用sudo

原创粉丝点击