Jenkins权限被拒绝 [英] Jenkins Permission Denied

查看:348
本文介绍了Jenkins权限被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很抱歉来到这里问这个问题,但是我已经读完了所有互联网,试图找到解决方案,但是我仍然遇到这个问题...

I'm sorry to come here and ask for that but I have read all the internet trying to find a solution but I still have this problem...

我已经成功安装了詹金斯(可以在我仍然希望的时候开始),可以在我们的持续集成流程中使用它.

I have installed successfully (let's start when I still had hope) jenkins to use it in our continous integration flow.

我试图从这样一个简单的例子开始:

I tried to start with a simple example like this one :

pipeline {
    agent any
    stages {
        stage('Build') {
            steps {
                sh 'mvn -B -DskipTests clean package' 
            }
        }
    }
}

但是每次启动时,都会出现此错误:

But each time I start it, I have this error :

sh: /var/lib/jenkins/workspace/Test@tmp/durable-f70a79f3/script.sh: Permission denied

问题是用户jenkins(服务和主节点以Jenkins的身份运行)拥有此存储库上的所有权限.我试图授予组和其他人读取和执行的权限,但是它没有任何改变.

The problem is that user jenkins (service and the master node are running as Jenkins) have all the permissions on this repository. I tried to give group and others permissions to read and execute too but it doesn't change anything.

[centos@jenkins workspace]$ ll
total 8
drwxr-xr-x 2 jenkins jenkins 4096 Dec  8 18:35 Test
drwxr-xr-x 2 jenkins jenkins 4096 Dec 11 16:40 Test@tmp

我们正在使用这些参数启动詹金斯:

We are launching jenkins with those parameters :

 -Djava.awt.headless=true -Djenkins.install.runSetupWizard=false -Djava.io.tmpdir=/var/lib/jenkins/tmp

并在/jenkins网址上.除此之外,我看不出是什么原因造成的...

and on a /jenkins url. Other than that, I don't see what could be the cause of the problem...

edit:使用noexec挂载的卷

edit : Mounted volumes with noexec

sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_prio,net_cls)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpuacct,cpu)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
/dev/mapper/rootvg-var_lv on /var type ext4 (rw,nodev,noexec,relatime,nobarrier,data=ordered)

非常感谢您的帮助.

推荐答案

确实是带有noexec的/var ...我不认为所有/var都位于noexec中.我读了10遍,甚至没有尝试更改它.谢谢您的帮助.

It was indeed the /var with noexec... I didn't thought all /var was in noexec. I read 10 times this line without even trying to change it... Thank you for your help

解决方案: 就像我在评论中所说的,就是这一行:

Solution : Like I said in comments, it was this line :

/dev/mapper/rootvg-var_lv on **/var** type ext4 (rw,nodev,**noexec**,relatime,nobarrier,data=ordered)

所以我使用了sudo mount -o remount,exec /var,它现在工作正常.

So I used sudo mount -o remount,exec /var and it's working fine now.

这篇关于Jenkins权限被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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