我刚刚安装了 Ubuntu,我的用户是一个超级用户,可以使用sudo. 所以我认为这个用户被添加到/etc/sudoers文件中。但它似乎不存在:
#
# 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:/snap/bin"
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL:ALL) ALL
# Members of the admin group may gain root privileges
%admin 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
Run Code Online (Sandbox Code Playgroud)
用户信息:
uid=1000(someuser) gid=1000(someuser) groups=1000(someuser),4(adm),24(cdrom),27(sudo),
30(dip),46(plugdev),113(lpadmin),128(sambashare)
Run Code Online (Sandbox Code Playgroud)
我是如何获得超级用户权限的?
你在组中sudo。引用您的 sudoers 文件(我提请您注意有效行之前的有用评论):
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1326 次 |
| 最近记录: |