这个问题在这里已经有了答案:
How to fix 'sudo: no tty present and no askpass program specified' error?
(29 个回答)
6 个月前关闭。
我花了几天时间设置文件 /etc/sudoers
能够授予用户 root 权限 jenkins
.我在我的服务器上安装了 Jenkins,因为我用 symfony、ionic、neo4j 等托管了几个项目......问题是我不能用 ionic 构建项目,我收到这个错误:sudo: no tty present and no askpass program specified.
这是我的/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"
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL:ALL) ALL
jenkins ALL=(ALL) NOPASSWD: ALL
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
最佳答案
我已经在问题的评论中测试了@Jayan 描述的解决方案。您必须在文件末尾包含新行:
解决方案:https://stackoverflow.com/a/24648413/54506
#
# 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
jenkins ALL=(ALL) NOPASSWD: ALL
关于 Jenkins 须藤 : no tty present and no askpass program specified with NOPASSWD,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37603621/