title: jenkins doesn't have rights to copy files - or does it?
body: <p>I have a strange problem in jenkins, I cannot copy files in a job, however, with the user jenkins on the command line, I can do that without problem. </p>
  
  <p>I am using jenkins on debian running under the user "jenkins".  </p>
  
  <p>I added the user "jenkins" to the group "www-data", so that I can copy files to the www-folder of apache.  </p>
  
  <p>The folder rights of the target folder look like this:  </p>
  
  <pre><code>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  
  </code></pre>
  
  <p>So everything is writable for group www-data.  </p>
  
  <p>If I am using the jenkins user to copy the files in the shell, I get no error:</p>
  
  <pre><code>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$   
  </code></pre>
  
  <p>But if I use the same command in jenkins itself, it fails with permission error:</p>
  
  <pre><code>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  
  </code></pre>
  
  <p>How is that possible? Does anyone have an idea?</p>