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

On a RedHat system, i'm trying to launch a program with a different user who dont have any shell. In /etc/passwd, shell is /sbin/nologin.

I have tried:

  1. su myuser -c /home/myuser/ Result: This account is currently not available.

  2. With chown and setuid: chown myuser:mygroup /home/myuser/ chmod +s /home/myuser/ /home/myuser/ Result: is still executed as my signed in user (root).

share|improve this question
Are you running the su as root or an unprivileged user? – James O'Gorman Jan 17 '12 at 14:23
up vote 13 down vote accepted


su myuser -s /bin/sh -c /home/myuser/
share|improve this answer
Thanks you. It works! It was simple... :) – Karl Jan 17 '12 at 14:33

this error means that in /etc/passwd you have set shell /sbin/nologin or /sbin/false for user myuser.

Please set something usefull like /bin/bash

share|improve this answer
That's what the OP already posted was happening; OP is asking if there's a way to run the program despite the username having no shell. – Bart Silverstrim Jan 17 '12 at 14:13
Yes... It is the question in fact. I would like to know if it is possible to run a script as a different user, without setting a shell in /etc/passwd – Karl Jan 17 '12 at 14:15
You can not do it using script if user have shell like this. – user106666 Jan 17 '12 at 14:17

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.