Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have installed mysql-server. When I run User Administration Tool it only shows my user name (myname) and root. When I want to add mysql user it says that user mysql already exists but it doesn't shown on the User Administration Tool user list why? I checked the user list

cat /etc/passwd

and I can see the mysql user. After thanI set up a home directory for mysql user

sudo usermod -d /home/mysql mysql

then I change user to mysql

sudo -s -u mysql

after then I want to go to home directory of mysql user.

cd ~
pwd

it shows /home/myname not /home/mysql I checked /etc/passwd and it show /home/mysql as a home directory for mysql user. Why it is like that?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

First of all, you'll probably find that your User Administration tool doesn't show system accounts (usually user id less than 1000 on Ubuntu), which is why you're only seeing yourself and root, and why you can't add a mysql user, but you can see it in /etc/passwd.

Secondly, you'll probably find that the mysql user has something like /bin/false as their shell, so you'll change to their account, run /bin/false which will exit straight away and therefore log you out again. This will leave you as your account, which would explain why you're seeing your home directory.

Alternatively, it might be because you used sudo -s rather than sudo -i to get a shell. You should not use sudo -s if you want a shell, as -s will not replace all of the environment. Certain variables will still refer to the previous user. I believe that $HOME is one of those variables.

share|improve this answer
    
Thanks David. it is /bin/bash I tried first sudo -i as you said and become root then I wrote su mysql and then pwd voila it show /home/mysql. I cant vote you because I dont have repution but you solved thanks a lot. –  rainman Jul 28 '09 at 15:29
    
You can now :) not that it matters, as I can't get any more reputation today :) –  David Pashley Jul 28 '09 at 17:07
    
Thanks David. I voted you when I saw the repution. It was a good answer anyway:-) –  rainman Jul 28 '09 at 21:44

Your Answer

 
discard

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.