Visakh Viswambaren
Visakh Viswambaren

Reputation: 63

Jenkins Gerrit Trigger - "/var/lib/jenkins/.ssh/id_rsa" is not a valid key file

I've installed Jenkins in an Ubuntu server by following the documentation from Jenkins Install documentation and I am trying to set up Gerrit Trigger Plugin. While setting up Administrative Settings section the SSH Keyfile section always gives the error "/var/lib/jenkins/.ssh/id_rsa" is not a valid key file.

I've generated the ssh keys as the Jenkins user in the default location "/var/lib/jenkins/"

I've tried generating the keys with ssh-keygen, ssh-keygen -t rsa, ssh-keygen -t rsa -b 2048 and the keys are generated with and without a passphrase also as pem file but still shows as invalid key file.

The files are present in the "/var/lib/jenkins/.ssh/" location

jenkins@jenkins:~/.ssh$ ls -la
total 16
drwx------  2 jenkins jenkins 4096 Oct  9 14:18 .
drwxr-xr-x 17 jenkins jenkins 4096 Oct  9 14:18 ..
-rw-------  1 jenkins jenkins 2602 Oct  9 14:05 id_rsa
-rw-r--r--  1 jenkins jenkins  569 Oct  9 14:05 id_rsa.pub

I didn't find any log entries regarding this in jenkins log file also not in the web portal System Log section.

Upvotes: 6

Views: 3386

Answers (2)

Nishanth
Nishanth

Reputation: 45

Following are the steps worked for me.

  1. Currently my Jenkins home directory is pointing to /home/home_for_jenkins .And I need to use a different BOT user to fetch the Gerrit events.

  2. In order to achieve the above requirement, I have generated ssh keys for BOT user by using ssh-keygen -m PEM command and copied the generated keys to /home/home_for_jenkins folder and changed the permissions accordingly

Upvotes: 0

Try to generate the key with the following command:

ssh-keygen -m PEM

Upvotes: 9

Related Questions