Can't Su to User Jenkins After Installing Jenkins

Can't su to user jenkins after installing Jenkins

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

How to become a Jenkins user?

Basically for this Jenkins user jenkins bash was not configured.

jenkins:x:496:492:Jenkins Continuous Build server:/var/lib/jenkins:/bin/false

So we need to set the bash for this user and that resolved the issue. I used the following command:

sudo usermod -s /bin/bash jenkins

See below:

jenkins:x:496:492:Jenkins Continuous Build server:/var/lib/jenkins:/bin/bash

And now I can perform su and can use bash.

Jenkins User Login - Ubuntu

Aah Found the solution

running

sudo usermod -s /bin/bash jenkins

did the job.
similar question posted here too

How to access Jenkins after enabling require login?

To fix this follow the instructions

Stop Jenkins (the easiest way to do this is to kill the servlet
container.)

Go to $JENKINS_HOME in the file system and find config.xml file.

Open this file in the editor.

Look for the <useSecurity>true</useSecurity> element in this file.

Replace true with false

Remove the elements authorizationStrategy and securityRealm

Start Jenkins



Related Topics



Leave a reply



Submit