Redhat – switch to a different user

redhatsu

I'm trying to SSH into a server then switch to a user named "jenkins". As you can see from the commands below, after I run su - jenkins I am still in the root user's home dir, and whoami indicates that I am still root, even though su doesn't return an error

don@Don-MacBook-Air:~$ ssh root@perkins.corp.foo
root@perkins.corp.foo's password: 
Last login: Thu Jan  8 03:02:23 2015 from 10.0.16.57
root@perkins.corp.foo:~ $ whoami
root
root@perkins.corp.foo:~ $ su - jenkins
root@perkins.corp.foo:~ $ whoami
root
root@perkins.corp.foo:~ $ pwd
/root

I've verified that there is a user named jenkins so I don't understand why this is failing. The server is running Red Hat 4.4.7-4.

Best Answer

Would assume your jenkins is "disabled" by setting it's shell to /bin/false. Try to set the shell to /bin/bash (f.e.)

chsh -s /bin/bash jenkins

then your su should work.

Or use

su -s /bin/bash jenkins