Jenkins(十二)修改用户使用sudo不再需要密码

以创建的jenkins用户为例。

1、先以root用户的身份登录,然后执行visudo   , 或者其他具有sudo 权限的用户执行 sudo  visudo也是一样的

2、在打开的文件中找到

## Allow root to run any commands anywhere
root    ALL=(ALL)       ALL

在这一行下面添加用户名,然后保存退出,之后用户就具有使用sudo命令的权限了。

## Allow root to run any commands anywhere
root    ALL=(ALL)       ALL
jenkins    ALL=(ALL)    ALL

3、如果要让用户在使用sudo的时候不再需要输入密码,还需要修改刚才的文件visduo

## Allow root to run any commands anywhere
root    ALL=(ALL)       ALL


## Allows members of the 'sys' group to run networking, software,
## service management apps and more.
# %sys ALL = NETWORKING, SOFTWARE, SERVICES, STORAGE, DELEGATING, PROCESSES, LOCATE, DRIVERS


## Allows people in group wheel to run all commands
# %wheel        ALL=(ALL)       ALL


## Same thing without a password
# %wheel        ALL=(ALL)       NOPASSWD: ALL

将绿线所示的这一行的注释去掉启用,添加用户到这一行就可以了,然后保存退出。

执行命令:gpasswd -a jenkins wheel (jenkins是以我创建的用户名为例)

命令执行之后用户就不需要再输入密码了

修改之后

## Allow root to run any commands anywhere
root    ALL=(ALL)       ALL
jenkins    ALL=(ALL)    ALL


## Allows members of the '

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值