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/script.sh Result: This account is currently not available.

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

  • Are you running the su as root or an unprivileged user? – James O'Gorman Jan 17 '12 at 14:23


su myuser -s /bin/sh -c /home/myuser/script.sh

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

  • 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
  • 1
    You can not do it using script if user have shell like this. – user106666 Jan 17 '12 at 14:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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