我创建了几个别名,这些别名来自于shell:
alias apti="apt-fast install -y"
alias aptr="apt-fast remove -y"
alias aptp="apt-fast purge -y"
alias apts="aptitude search"
alias aptu="sudo dpkg --configure -a; apti -f; apt-fast update; apt-fast upgrade -y; apt-fast full-upgrade -y; apt-fast autoremove -y"然后在/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
Cmnd_Alias APT=/usr/local/bin/apt
Cmnd_Alias DPKG=/usr/bin/dpkg
Cmnd_Alias APTGET=/usr/bin/apt-get
Cmnd_Alias APTITUDE=/usr/bin/aptitude
Cmnd_Alias APTFAST=/usr/sbin/apt-fast
Cmnd_Alias PM_SUSPEND=/usr/sbin/pm-suspend
myuser ALL=(ALL:ALL) NOPASSWD: APT, DPKG, APTGET, APTITUDE, PM_SUSPEND, APTFAST几年来一切都很顺利。但是几周前(linux更新?)它开始给我带来错误。
$ apti iridium-browser
sudo: sorry, you are not allowed to set the following environment variables: DEBUG, LCK_FILE, DOWNLOADBEFORE, _APTMGR, APTCACHE, DLDIR, DLLIST, LISTDIR, _MAXNUM, _MAXCONPERSRV, _SPLITCON, _MINSPLITSZ, _PIECEALGO, aptfast_prefix, APT_FAST_TIMEOUT在/etc/sudoers.d中有两个文件: README和mintupdate。我没有编辑过其中的任何一个。只有没有注释的行是:
Cmnd_Alias UPDATE = /usr/lib/linuxmint/mintUpdate/checkAPT.py
ALL ALL = NOPASSWD:UPDATE据我所见,我没有设置任何被lissted的环境变量。我做错了什么?
发布于 2020-08-25 21:59:19
在lazarus程序中将"sudo命令“作为进程执行时,我也收到了此错误消息,但当我将其更改为"/usr/bin/sudo命令”时,它在没有错误的情况下工作正常,因此,在我的示例中,生成错误的似乎是“sudo”的缺失路径。
https://unix.stackexchange.com/questions/383548
复制相似问题