linux为普通用户添加sudo权限

    xiaoxiao2022-06-28  46

    <pre name="code" class="python"># 添加用户 useradd AAA # 设置密码 passwd # 为用户添加sudo权限 # sudo权限的文件在/etc/sudoers中 # sudoers文件的权限应该是-r--r----- , root账户和其组内账户只能读文件 # 切换到root账户下 su - root # 为root账户添加些权限 chmod u+w /etc/sudoers # 打开文件,在文件中查找 root ALL=(ALL) NOPASSWD:ALL # 添加 AAA ALL=(ALL) NOPASSWD:ALL # 表示AAA账号拥有所有root权限,且不需要输入密码 # 撤销/etc/sudoers文件的root账号写权限 chmod u-w /etc/sudoers
    转载请注明原文地址: https://ju.6miu.com/read-1124413.html

    最新回复(0)