詹金斯无权复制文件 - 或者是吗?

fer*_*i2k 9 jenkins

我在jenkins中有一个奇怪的问题,我无法在作业中复制文件,但是,在命令行上使用jenkins用户,我可以毫无问题地执行此操作.

我在用户"jenkins"下使用jenkins运行debian.

我将用户"jenkins"添加到"www-data"组中,这样我就可以将文件复制到apache的www文件夹中.

目标文件夹的文件夹权限如下所示:

drwxrwxr-x 9 www-data www-data 4096 Jun 23 16:19 .   
drwxrwxr-x 4 www-data www-data 4096 Jun 23 12:45 ..  
-rw-rw-r-- 1 volker   www-data  368 Jun 23 17:10 about.php  
-rw-rw-r-- 1 volker   www-data  366 Jun 23 17:10 bio.php  
-rw-rw-r-- 1 volker   www-data  370 Jun 23 17:10 contact.php   
drwxrwxr-x 3 volker   www-data 4096 Jun 23 16:19 content  
drwxrwxr-x 3 volker   www-data 4096 Jun 23 16:19 css  
drwxrwxr-x 8 volker   www-data 4096 Jun 23 16:19 default  
drwxrwxr-x 3 volker   www-data 4096 Jun 23 16:19 fonts  
drwxrwxr-x 2 volker   www-data 4096 Jun 23 13:40 image  
drwxrwxr-x 3 volker   www-data 4096 Jun 23 16:19 images  
-rw-rw-r-- 1 volker   www-data  372 Jun 23 17:10 impressum.php  
-rw-rw-r-- 1 volker   www-data  367 Jun 23 17:10 index.php  
-rw-rw-r-- 1 volker   www-data  296 Jun 23 13:52 kontakt.php  
drwxrwxr-x 3 volker   www-data 4096 Jun 23 16:19 layout   
-rw-rw-r-- 1 volker   www-data  367 Jun 23 17:10 news.php  
-rw-rw-r-- 1 volker   www-data  370 Jun 23 17:10 termine.php  
-rw-rw-r-- 1 volker   www-data  369 Jun 23 17:10 videos.php  
Run Code Online (Sandbox Code Playgroud)

所以一切都可以写成组www-data.

如果我使用jenkins用户复制shell中的文件,我没有收到任何错误:

jenkins@rootserver:~/jobs/deploy_notundellende/workspace$ whoami  
jenkins  
jenkins@rootserver:~/jobs/deploy_notundellende/workspace$ cp -R * /var/www/nue  
jenkins@rootserver:~/jobs/deploy_notundellende/workspace$   
Run Code Online (Sandbox Code Playgroud)

但是如果我在jenkins本身使用相同的命令,它会失败并出现权限错误:

pwd  
/var/lib/jenkins/jobs/deploy_notundellende/workspace  
whoami  
jenkins  
cp -R about.php bio.php contact.php content css fonts images impressum.php index.php   layout news.php termine.php videos.php /var/www/nue  
cp: cannot create regular file `/var/www/nue/about.php': Permission denied  
cp: cannot create regular file `/var/www/nue/bio.php': Permission denied  
cp: cannot create regular file `/var/www/nue/contact.php': Permission denied  
cp: cannot create regular file `/var/www/nue/content/videos.php': Permission denied  
Run Code Online (Sandbox Code Playgroud)

怎么可能?有没有人有想法?

fer*_*i2k 13

好的,我让它工作,我重新启动jenkins服务器,它工作.我认为它之前没有用,因为当我更改权限时jenkins服务器已经运行了.现在对我有意义,来想一想:)无论如何,感谢任何人阅读和思考这个!