0

So I'm trying to create a user in gerrit using the command : cat /var/lib/jenkins/.ssh/id_rsa.pub | ssh -p 29418 webadm@localhost gerrit create-account --group "'Non-Interactive Users'" --ssh-key - jenkins-watcher

so first thing first I logged with my webadm user then I created a ssh keypair sh-keygen then I deployed my public key in the server : ssh-copy-id webadm@localhost

so now that my webadm's ssh public key is deployed in the server authorized key list, I should be able to run this command.

I then changed the permission of the public key to be able to use it : sudo chown webadm /var/lib/jenkins/.ssh/id_rsa.pub

however when I run the command I get :

webadm@continuous:~/.ssh$ cat /var/lib/jenkins/.ssh/id_rsa.pub | ssh -p 29418 webadm@localhost gerrit create-account --group "'Non-Interactive Users'" --ssh-key - jenkins-watcher
cat: /var/lib/jenkins/.ssh/id_rsa.pub: Permission denied
Permission denied (publickey).

By checking with ls -l i can see that webadm does have ownership of the file, so why can't he access it?

Thanks.

Heetola
  • 101
  • 2
  • What are the permissions of the folders /var, /var/lib, /var/lib/jenkins, /var/lib/jenkins/.ssh. The user webadm must have the permissions to decent in the directories. – Alexander Worlitschek Feb 25 '20 at 11:00
  • @AlexanderWorlitschek that must be it, webadm does not have access to those folders, sorry quite new to unix systems, thanks :) – Heetola Feb 25 '20 at 11:08
  • any chance you could post the permissions on the `/var/lib/jenkins/.ssh` folder as well as the key (as shown with `ls -l`). It's possible you've got ownership without read rights or webadm can't access the folder itself. – sippybear Feb 25 '20 at 18:20

0 Answers0