一.修改Jenkins进程用户为root
[[email protected] ~]# cat /etc/sysconfig/jenkins | grep JENKINS_USER JENKINS_USER="jenkins" [[email protected] ~]# [[email protected] ~]# [[email protected] ~]# sed -i 's#JENKINS_USER="jenkins"#JENKINS_USER="root"#' /etc/sysconfig/jenkins [[email protected] ~]# [[email protected] ~]# cat /etc/sysconfig/jenkins | grep JENKINS_USER JENKINS_USER="root" [[email protected] ~]#
二.将代码目录用户改为Jenkins
[[email protected] ~]# mkdir -p /home/yinzhengjie/data/jenkins/www [[email protected] ~]# [[email protected] ~]# chown -R jenkins.jenkins /home/yinzhengjie/data/jenkins/www/ [[email protected] ~]# [[email protected] ~]# ll -d /home/yinzhengjie/data/jenkins/www/ drwxr-xr-x 2 jenkins jenkins 6 Sep 9 08:04 /home/yinzhengjie/data/jenkins/www/ [[email protected] ~]# [[email protected] ~]# chmod +x /home/yinzhengjie/ -R #这个执行权限必须得加,因为Jenkins默认是没有访问yinzhengjie用户家目录的权限哟! [[email protected] ~]# [[email protected] ~]# ll /home/yinzhengjie/data/jenkins/www/ total 0 [[email protected] ~]#
三.使用sudo授权
这个想必大家都会,要么使用命令“visudo”编辑授权,要么使用命令“vi /etc/sudoers”进行编辑,将Jenkins用户权限提升为管理员权限。
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/tech/aiops/2429.html