问题描述:html
jenkins执行发布脚本,由于使用的是jenkins用户,因此有些shell命令须要 sudo 来执行,致使报错。nginx
+ sudo rm -rf /usr/share/nginx/html/jenkins_test.bak
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
sudo: no tty present and no askpass program specified
解决办法:shell
编辑 '/etc/sudoers' 文件,由于没有编辑权限,须要增长权限spa
chmod u+w /etc/sudoers
进入编辑模式,找到htm
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
在下面加入一行,jenkins换成要使用 sudo 命令的用户blog
jenkins ALL=(ALL) ALL
而后保存,退出,恢复文件的权限three
chmod u-w /etc/sudoers