Cannot Switch to Jenkins User Redhat Linux

Cannot Switch to Jenkins User Redhat Linux

I have a redhat linux server running jenkins. I setup jenkins as per the instructions mentioned here The problem is that I need to switch to the jenkins user in order to solve an ssh connection issue, but I cannot.

I try

su - jenkins

however after I enter that, the terminal remains[root@redhat ~]# and a whoami reveals that I am still root I have looked at the files /etc/passwd etc/shadow and see that jenkins is a user, but I don't have enough experience to tell what I have done wrong in setting up this jenkins user.

any ideas would be helpful, or places to look for clues?

3 Answers

is jenkins a service account with no shell configured in /etc/password If that's it try sudo su -s /bin/bash jenkins

2

Do not change the /etc/passwd file. The interactive login is set to false for a good reason, the list security implications is too long to describe here.

Instead, run this as root:

sudo su - jenkins -s /bin/bash

The other option would be to change the shell for jenkins.

Run the below command:

chsh -s /bin/bash jenkins

Now you will be able to switch as jenkins user by just passing su jenkins

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Alexander Ross
Author

Alexander Ross

Alexander Ross has covered the video game industry for a decade, writing deep dives on game design, esports tournaments, VR developments, and gaming culture.