Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am entering to an Ubuntu Server using root, and I need to run a background process as a more limited user, so I write

su -l limitedUser -c 'programName'

But nothing happens. Even if programName is something like echo, nothing is being executed. What could be going on? Is there a log I could take a look at?

PS: I know nothing is being executed as TOP or PS AFX don't show anything new running.

share|improve this question
    
What happens if you su to limitedUser with su -l limitedUser and then, when you get the prompt, type programName<ENTER>? Does it run at all? Remember that, as answered by Ярослав below, the user has to be enabled and have a shell like /bin/bash, etc (not something like /bin/false). –  jaume Oct 17 '12 at 6:55
    
The problem was that it was pointing to /bin/false like you said. Thanks! –  Luciano Oct 17 '12 at 13:04

1 Answer 1

The user has to be enabled (have password set, not be expired, etc).

It is possible that your su does not issue a warning like mine. You may consult /var/log/auth.log to see what is happening

# su apache -c bash
This account is currently not available.
# tail -n 10 /var/log/auth.log 
Oct 17 05:53:16 geee su[30744]: Successful su for apache by root
Oct 17 05:53:16 geee su[30744]: + /dev/pts/11 root:apache
Oct 17 05:53:17 geee su[30744]: pam_unix(su:session): session opened for user apache by (uid=0)
Oct 17 05:53:17 geee nologin: Attempted login by jaroslav on /dev/pts/11
Oct 17 05:53:17 geee su[30744]: pam_unix(su:session): session closed for user apache
Oct 17 05:53:20 geee su[30748]: Successful su for apache by root
Oct 17 05:53:20 geee su[30748]: + /dev/pts/11 root:apache
Oct 17 05:53:20 geee su[30748]: pam_unix(su:session): session opened for user apache by (uid=0)
Oct 17 05:53:20 geee nologin: Attempted login by jaroslav on /dev/pts/11
Oct 17 05:53:20 geee su[30748]: pam_unix(su:session): session closed for user apache
share|improve this answer

Your Answer

 
discard

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.