`
shappy1978
  • 浏览: 680429 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

Run sudo in Jenkins

    博客分类:
  • CI
阅读更多

Some script need to run with sudo command, if we get error that permission deny, we need to run with sudo.

To enable sudo in jenkins, need to add bellow line to /etc/sudoers

jenkins ALL=NOPASSWD: /pathOfMyScript

But if you don't use root user to make such change, you will get error: 

sudo: /etc/sudoers is owned by uid xxx, should be 0

Bcoz we normally won't use root for dev. First need to enable root user:

Setting>user>Login Options>Network account server>Join buton>Open Directory Utility

In "Edit" menu, enable root user and set password, then logout and user root acc.

runn bellow command:

$cd etc
$chgrp wheel sudoers
$chown root /etc/sudoers

 

* User root to enhance sudoers will better.

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics