Exploring Exploring - 2 years ago 144
Bash Question

How to become a Jenkins user?

I have installed Jenkins and during installation an user named

has been created. I can see from the documentation:

The 'jenkins' user is created to run this service.

Now I need to become this
user. I have in the following ways:

[[email protected] ~]# sudo su - jenkins
[[email protected] ~]# id
uid=0(root) gid=0(root) groups=0(root)

[[email protected] tmp]# su - jenkins
[[email protected] tmp]# whoami

Why switch user to the jenkins user is not working?

I am on RHEL.

cat /etc/*release
Red Hat Enterprise Linux Server release 6.3 (Santiago)

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download