I am trying to switch the user in my shell with su - [user]
, but the user seems to remain the old one:
# this works pretty well
bodo@bodo-work:~$ sudo -u mysql whoami
[sudo] password for bodo:
mysql
but not this
bodo@bodo-work:~$ whoami
bodo
bodo@bodo-work:~$ su - mysql
Password:
still having 'bodo' as user seems to be wrong here
bodo@bodo-work:~$ whoami
bodo # what?
Please note that there was no error message, like could not find home directory. What am I doing wrong here? The defined home directory of the user mysql belongs to it:
sudo ls -lah /var/lib/mysql
total 215M
drwx------ 7 mysql mysql 4,0K Feb 10 14:30 .
# [...]
/sbin/nologin
since I cannot see this forgrep mysql /etc/passwd
(mysql:x:127:134:MySQL Server,,,:/var/lib/mysql/:/bin/false
). Is it/bin/false
? I also do not get your last point: where should I runsu
for getting this message? – BairDev Feb 10 '22 at 15:26/bin/false
and that is always going to eject straight away, hence noThis account is cur...
. If you change the shell to/sbin/nologin
, you will get the error message. – Bib Feb 10 '22 at 15:28