Centos 7 将用户添加到sudoers

    xiaoxiao2021-03-25  105

    1. su root //先切到root

    2. chmod u+w /etc/sudoers   //u 表示所有者, w 表示写权限 + 表示添加

    3. vi /etc/sudoers

        在文件中找到这一行:

    ## Allow root to run any commands anywhere root    ALL=(ALL)       ALL

    username ALL=(ALL)ALL  //添加这一行,username为要加入sudoers 的用户

    4. 最后记得撤销文件的写权限: chmod u-w /etc/sudoers 

    others:

     chown -R username dir  chgrp -R groupname dir

    //修改文件夹及其文件的所有者(chown) ,或所在的组(chgrp),username 为所有者,groupname为组名,dir:需要修改的文件

    转载请注明原文地址: https://ju.6miu.com/read-22386.html

    最新回复(0)