1. 程式人生 > >centos7為使用者新增root許可權

centos7為使用者新增root許可權

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