linux – 如何将自己添加到sudoers列表?
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了linux – 如何将自己添加到sudoers列表?,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1630字,纯文字阅读大概需要3分钟。
内容图文
我已经使用该命令将自己添加到sudoers用户列表中
root@debian:/home/oshirowanen#adduser oshirowanen sudo
如果我再次尝试运行该命令,
root@debian:/home/oshirowanen# adduser oshirowanen sudo
The user `oshirowanen' is already a member of `sudo'.
root@debian:/home/oshirowanen#
到目前为止看起来都不错.
当我退出root用户并尝试使用我自己的帐户安装/删除/搜索某些内容时,它无效并抱怨我不是sudoer …例如
root@debian:/home/oshirowanen# exit
exit
oshirowanen@debian:~$sudo aptitude search ice
[sudo] password for oshirowanen:
oshirowanen is not in the sudoers file. This incident will be reported.
oshirowanen@debian:~$
为什么会这样?
这是我从visudo得到的
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
Defaults mail_badpass
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL:ALL) ALL
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
# See sudoers(5) for more information on "#include" directives:
#includedir /etc/sudoers.d
解决方法:
将自己添加到组后,您需要再次登录才能获得正确的权限.
要验证两个shell:
alice $sudo adduser test
alice $su - test
alice $sudo adduser test sudo
test $sudo ls
test is not in the sudoers file. [...]
test $exit
alice $su - test
test $sudo ls
examples.desktop
为了澄清,在将用户添加到sudo组之前打开的任何shell都没有新的权限.
内容总结
以上是互联网集市为您收集整理的linux – 如何将自己添加到sudoers列表?全部内容,希望文章能够帮你解决linux – 如何将自己添加到sudoers列表?所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。