Bash – su does not change user but does not respond with an error either

bashsu

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?

Best Answer

  • 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.

  • Related Question