When attempting to install plugins using the Update Center, plugins can not be written to /var/lib/jenkins/plugins due to invalid permissions.
hudson.util.IOException2: Failed to download from http://updates.jenkins-ci.org/download/plugins/ssh/2.4/ssh.hpi (redirected to: http://ftp-nyc.osuosl.org/pub/jenkins/plugins/ssh/2.4/ssh.hpi)
at hudson.model.UpdateCenter$UpdateCenterConfiguration.download(UpdateCenter.java:797)
at hudson.model.UpdateCenter$DownloadJob._run(UpdateCenter.java:1148)
at hudson.model.UpdateCenter$InstallationJob._run(UpdateCenter.java:1309)
at hudson.model.UpdateCenter$DownloadJob.run(UpdateCenter.java:1126)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at hudson.remoting.AtmostOneThreadExecutor$Worker.run(AtmostOneThreadExecutor.java:110)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.io.FileNotFoundException: /var/lib/jenkins/plugins/ssh.jpi.tmp (Permission denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:206)
at java.io.FileOutputStream.<init>(FileOutputStream.java:156)
at hudson.model.UpdateCenter$UpdateCenterConfiguration.download(UpdateCenter.java:763)
... 7 more
**@** /var/lib/jenkins $ ls -al
total 80
drwxr-xr-x 11 jenkins jenkins 4096 May 21 19:27 .
drwxr-xr-x 48 root root 4096 May 2 18:23 ..
rw-rr- 1 systemd-timesync sambashare 0 Apr 10 19:04 atomic3320745316088279947.tmp
rw-rr- 1 jenkins jenkins 1715 May 21 19:15 config.xml
rw-rr- 1 jenkins jenkins 0 May 21 19:10 Download metadata.log
rw-rr- 1 systemd-timesync sambashare 0 Apr 11 04:16 Fingerprint cleanup.log
rw-rr- 1 jenkins jenkins 160 May 21 19:27 hudson.model.UpdateCenter.xml
rw------ 1 systemd-timesync sambashare 1675 Apr 10 19:09 identity.key
drwxr-xr-x 3 jenkins jenkins 4096 May 21 19:09 .java
rw-rr- 1 jenkins jenkins 138 May 21 19:14 jenkins.model.DownloadSettings.xml
rw-rr- 1 jenkins jenkins 169 May 21 19:14 jenkins.security.QueueItemAuthenticatorConfiguration.xml
drwxr-xr-x 2 jenkins jenkins 4096 May 21 19:13 jenkins.security.RekeySecretAdminMonitor
drwxr-xr-x 2 systemd-timesync sambashare 4096 Apr 10 18:56 jobs
rw-rr- 1 jenkins jenkins 907 May 21 19:10 nodeMonitors.xml
drwxr-xr-x 2 jenkins jenkins 4096 May 21 19:09 nodes
rw-rr- 1 systemd-timesync sambashare 51 Apr 11 15:56 .owner
drwxr-xr-x 2 systemd-timesync sambashare 4096 Apr 10 18:56 plugins
rw-rr- 1 systemd-timesync sambashare 46 Apr 11 16:18 queue.xml.bak
rw-rr- 1 systemd-timesync sambashare 64 Apr 10 18:56 secret.key
drwxr-xr-x 4 jenkins jenkins 4096 May 21 19:15 secrets
drwxr-xr-x 2 jenkins jenkins 4096 May 21 19:28 updates
drwxr-xr-x 2 systemd-timesync sambashare 4096 Apr 10 19:09 userContent
drwxr-xr-x 3 jenkins jenkins 4096 May 21 19:15 users
Can be fixed by issuing:
sudo chown jenkins plugins
sudo chown jenkins userContent
sudo chgrp jenkins userContent
sudo chgrp jenkins plugins