Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

While logged in as root I would like to su to a specific regular user. I run su username and immediately receive the prompt back, still as root. There is no error given. I'm aware of the old "the user you're trying to su to doesn't have permission for the folder you're currently in" problem, and that's not the case in this scenario. Furthermore, there is no error displayed, which is always the case (as far as I know) when that particular permissions issue is encountered.

I've tried su - username with the same effect. The command is processed, no errors are seen, and I receive the prompt back immediately.

What could be causing this behavior? How can I troubleshoot this?

share|improve this question
What shell does the user have? Is it /bin/false? – camh May 25 '12 at 5:47
You should really be using sudo -u username -s (or -i) BTW. – mgorven May 25 '12 at 6:57
@camh facepalm That was it. I swear I checked /etc/passwd last night and it wasn't like that! =) Can you put that as an answer? I'll accept it. – Wesley May 25 '12 at 17:05
@mgorven Oooh, interesting. Never seen that before. I'll look into it. – Wesley May 25 '12 at 17:05
up vote 26 down vote accepted

Check what shell the user has in /etc/passwd. If the shell is /bin/false (a common shell to disallow logins), then you will see the behavior you describe. Alternatively, it may be some other immediately-terminating program that gives the same effective result.

share|improve this answer
That was it. I swear I looked first! =) – Wesley May 26 '12 at 2:42
And if you need to debug something under user which has /bin/falseas its shell, you can do it with su - user -s /bin/sh. – Marki555 May 27 '12 at 8:47

I'd suggest using strace on the su process to see where the process is failing.

strace su donaldduck

Should give you LOTS of output to sort through, but something in there should indicate where the problem is occurring.

share|improve this answer
Stupid markdown.... – Magellan May 25 '12 at 5:32

You should check the shell in /etc/passwd, and, without wishing to be patronising, check the output of whoami after running su.

share|improve this answer
Not sure why that would be considered patronizing, for I certainly wouldn't have taken it that way. I mean I can if you want, but that wouldn't be my first inclination. =) Anyway, yes, I forgot to state that I did that just to make sure I was who I thought I was, and I was still root and not the user I was trying to switch to. – Wesley May 25 '12 at 16:59

Check your system logs : using sudo should log all the actions. So if there is a problem, it should be written.

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.