Went through a lot of questions, but nothing seems to be solving my issue. Or to be more precise I am not sure if I am doing the whole thing correctly. So here it is:
Ha
In order to login as "jenkins" user, maybe you could try this:
sudo -s -H -u jenkins
And try to invoke:
bash-4.1$ whoami
jenkins
Hope it helps.
1) First make jenkins as real user by editing /etc/passwd file Change
/bin/false to /bin/bash
2) Login to jenkins user, Now Jenkins home directory will be /var/lib/jenkins
su - jenkins
3)Generate ssh keys again ( keys will be created in /var/lib/jenkins/.ssh)
ssh-keygen -t rsa
4) copy id_rsa.pub key and paste in your git's authorized_keys file
5) Still if it won't work, probably you have to check permissions of your .ssh directory and contents
chmod 700 ~/.ssh && chmod 600 ~/.ssh/*
I think the .ssh directory should live in /var/lib/jenkins.
Works for me
jenkins is a service account, it doesn't have a shell by design. It is generally accepted that service accounts shouldn't be able to log in interactively.
I didn't answer this one initially as it's a duplicate of a question that has been moved to server fault. I should have answered rather than linked to the answer in a comment.
if for some reason you want to login as jenkins, you can do so with: sudo su -s /bin/bash jenkins
I was having problems changing to the jenkins user. I needed to actually create the user properly in the system so I could log in to it. I ran this command to help me create the jenkins user in the system:
su -s /bin/bash jenkins
What I did: sudo -u jenkins ssh-keygen. It works so far