Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

As root I would like to login as a service user (jenkins - the CI server) and manipulate files with its user,group and umask settings.

Normally I would (as root) do sudo -i -u jenkins, or even su - jenkins. However jenkins' default shell is /bin/false, which exits immediately.

Is there a way to login as Jenkins but specify a different shell to use? Do I really have to change jenkins' shell in /etc/passwd/?

share|improve this question
up vote 6 down vote accepted

su on linux supports setting the shell with the --shell option

su jenkins --shell=/bin/bash

You will need to su as root for this to work. From the man page:

       If the target user has a restricted shell (i.e. the shell field of
       this users entry in /etc/passwd is not listed in /etc/shell), then
       the --shell option or the $SHELL environment variable wont be taken
       into account, unless su is called by root.
share|improve this answer

Have you read the manual page (or --help output) to the su command?

su -s /bin/bash -
share|improve this answer

How about:
su - jenkins -c /bin/bash


sudo -u jenkins /bin/bash

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.