Last night, on my server, I did:

sudo su - mysql 

to change to the mysql user so I could run the mysql client, which is set up so it will only authenticate from the mysql account. I successfully ran the mysql client and made the change to the database. Nothing changed on the server overnight.

Today, nothing I try will allow my to change to the mysql user. It appears to succeed, given the message about no home directory, but whoami still reports my user id and trying to run mysql still fails.

wade@snoopy:~$ sudo su - mysql
[sudo] password for wade: 
No directory, logging in with HOME=/
wade@snoopy:~$ whoami

wade@snoopy:~$ sudo su mysql
wade@snoopy:~$ whoami

wwilliam@snoopy:~$ sudo -s
root@snoopy:/home/wade# su mysql
root@snoopy:/home/wade# whoami

/etc/passwd for mysql:

mysql:x:110:119:MySQL Server,,,:/nonexistent:/bin/false

Has anyone ever seen behavior like this?


su invokes the other user's login shell as given in /etc/passwd. In your case that's /bin/false so you don't get any interactive shell.


sudo -u test /bin/bash


sudo -u test /usr/bin/mysql

or something like that instead.

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.