I'm trying to login to my mysql
user created by the MySQL installation in bash shell.
So the command I'm trying to do is:
sudo -i -u mysql
But, it does nothing (nothing printed out in the console, not connected to any user whatsoever, etc...). EDIT: The return value of the command is 1 though.
Here is the mysql
user line in the /etc/passwd
file:
mysql:x:89:89::/var/lib/mysql:/bin/false
I'm running on ArchLinux 64bit and the user I'm trying to connect to is local (no connection to a remote server whatsoever).
I'm trying to understand why I can login with any other user (like postgres
, root
, ...) but not mysql
.
Hope you can help!
This is intended behaviour. When you compare the /etc/passwd
line with other lines you'll notice that the user mysql
has /bin/false
setup as the shell while others have usually /bin/sh
or sth. similar.
When you sudo to mysql
you actually get a login for about a millisecond or so and then his "shell" gets executed. /bin/false
immediately returns with rc=1
(that's the only purpose of the false
command).
This is some kind of "trick" to prevent users from logging in as user mysql
although the account is otherwise fully operational.
The user mysql
may even have a valid password and be enabled but due to his odd shell setting you cannot login as him. Sometimes these technical users have /usr/bin/passwd
set as their shell. Then you can only sudo
to that user and change his password, nothing else.