Run sudo in Jenkins

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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值