Jenkins无法访问java:localhost jenkins [807]:启动Jenkins bash:/usr/bin/java:权限被拒绝 [英] Jenkins not able to access java : localhost jenkins[807]: Starting Jenkins bash: /usr/bin/java: Permission denied

查看:1004
本文介绍了Jenkins无法访问java:localhost jenkins [807]:启动Jenkins bash:/usr/bin/java:权限被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在centos 7上安装并配置了jenkins.我在文件/etc/init.d/jenkins中添加了有效的 java路径,即"/usr/bin/java" .

I have installed and configured jenkins on the centos 7.I have added valid java path i.e "/usr/bin/java" in the file /etc/init.d/jenkins.

下面是Java路径detils:

Below are the java path detils:

lrwxrwxrwx. 1 root root 22 Dec 24  2015 java -> /etc/alternatives/java

现在,从 root用户运行"service jenkins start"命令时,出现以下错误.

Now, on running "service jenkins start" command from root user, I am getting below error.

● jenkins.service - LSB: Jenkins Continuous Integration Server
   Loaded: loaded (/etc/rc.d/init.d/jenkins)
   Active: failed (Result: exit-code) since Wed 2016-07-13 18:25:51 IST; 5s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 807 ExecStart=/etc/rc.d/init.d/jenkins start (code=exited, status=1/FAILURE)

Jul 13 18:25:51 localhost systemd[1]: Starting LSB: Jenkins Continuous Integration Server...
Jul 13 18:25:51 localhost runuser[812]: pam_unix(runuser:session): session opened for user jenkins by (uid=0)
Jul 13 18:25:51 localhost jenkins[807]: Starting Jenkins bash: /usr/bin/java: Permission denied
Jul 13 18:25:51 localhost runuser[812]: pam_unix(runuser:session): session closed for user jenkins
Jul 13 18:25:51 localhost jenkins[807]: [FAILED]
Jul 13 18:25:51 localhost systemd[1]: jenkins.service: control process exited, code=exited status=1
Jul 13 18:25:51 localhost systemd[1]: Failed to start LSB: Jenkins Continuous Integration Server.
Jul 13 18:25:51 localhost systemd[1]: Unit jenkins.service entered failed state.
Jul 13 18:25:51 localhost systemd[1]: jenkins.service failed.

即使每个用户都可以访问java路径,我也无法弄清楚为什么它会给我拒绝权限.

I am not able to figure out why it's giving me permission denied even though every user having access to the java path.

还在运行"journalctl -xe"命令时,它也在日志下方显示:

Jul 13 18:45:33 localhost systemd[1]: Unit jenkins.service entered failed state.
Jul 13 18:45:33 localhost systemd[1]: jenkins.service failed.
Jul 13 18:45:33 localhost polkitd[20151]: Unregistered Authentication Agent for unix-process:27889:3161602 (system bus name :1.303, object path /org/freedesktop/PolicyKit1/AuthenticationAgen

Jenkins服务是否没有访问Java路径的权限?如果不是,为什么会出现该错误?

Is it like that the Jenkins service does't having permission to access the java path? if not why it's giving that error?

推荐答案

您有两种方法可以解决此问题.

You have two options to solve the problem.

  1. Jenkins服务由jenkins用户启动.该错误表明jenkins用户没有运行Java的权限.因此,请检查原始Java路径并将执行权限授予其他用户.
  2. 在jenkins.service单元文件中,更改服务的所有者.将User=jenkins替换为User=root
  1. Jenkins service is started by jenkins user. The error says that jenkins user does not have permission to run java. So check orginal java path and give execute permissions to other users.
  2. In jenkins.service unit file, change the owner of the service. Replace User=jenkins with User=root

这篇关于Jenkins无法访问java:localhost jenkins [807]:启动Jenkins bash:/usr/bin/java:权限被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆