Can't su to user jenkins after installing Jenkins Can't su to user jenkins after installing Jenkins jenkins 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


Use the below command:

su -s /bin/bash jenkins


When we installed a Jenkins its created a Jenkins user with = "/bin/false"

You will that information from cat /etc/password file.

cat /etc/passwd | grep jenkinsjenkins:x:995:993:Jenkins Automation Server:/var/lib/jenkins:/bin/false

the best way is already mentioned above in answer by @thekbb

su - jenkins -s /bin/bash

we can also switch with any other shell mentioned in /etc/shells file.

cat /etc/shells/bin/sh/bin/bash/usr/bin/sh/usr/bin/bash/bin/tcsh/bin/csh

to make the changes permanently you can modify the /etc/passwd, but it's highly not recommended because its a service/application user like Apache,MySQL,Nginx.

jenkins:x:995:993:Jenkins Automation Server:/var/lib/jenkins:/bin/bash