Jenkins设置默用户为root

2018-11-12  本文已影响0人  Mlotjve

最近在需要在jenkins执行shell脚本,由于Jenkins之前是默认在线安装的,这样jenkins设置了默认用户jenkins权限

如果要执行root用户命令,则报权限错误


image.png

所以要更换jenkins为root用户

改变步骤如下:

  1. 首先查找在线安装jenkins的目录, 然后执行

chown -R root:root xxxx

root@ubuntu:/usr/share# find / -name "jenkins"
find: ‘/proc/13931’: No such file or directory
/var/lib/jenkins
/var/log/jenkins
/var/cache/jenkins
/run/jenkins
/etc/default/jenkins
/etc/init.d/jenkins
/etc/logrotate.d/jenkins
/usr/share/jenkins
/usr/share/doc/jenkins
  1. 编辑文件 /etc/default/jenkins

JENKINS_USER=root
JENKINS_GROUP=root

image.png
  1. 启动jenkins服务
root@ubuntu:/usr/share# /etc/init.d/jenkins 
Correct java version found
Usage: /etc/init.d/jenkins {start|stop|status|restart|force-reload}
  1. 浏览器登录查看是否ok
上一篇下一篇

猜你喜欢

热点阅读