Jenkins 须藤 : no tty present and no askpass program specified with NOPASSWD

标签 jenkins sudo

这个问题在这里已经有了答案:





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/

相关文章:

python - sudo -E 不通过 PYTHONPATH

linux - 如何捕获 sudo 命令的交互响应?

jenkins - 如何在多分支管道中为特定分支设置下一个版本号

git - 如何在不指定后者的情况下将本地分支重置为远程跟踪分支?

git - 使用 GitHub Pull Request Builder 触发多个 Jenkins 构建

linux - 在 Vagrant 上配置期间如何以另一个用户身份执行命令?

python - 在 python 脚本中更改为 sudo 用户

shell - 如何确定 shell 脚本是否以 root 权限运行?

java - Jenkins + Maven 发布插件 : release:branch + Git - Unable to commit files

plugins - Jenkins Clearcase 插件