D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] Databases again

 

On Tue, 27 Jun 2006 14:14:55 +0100
Paul Weaver <iso@xxxxxxxxxxxx> wrote:

> 
> That's fine, but mysql is still running as root. A mysql command that
> caused mysqld to execute a local program would have full access to your
> machine (cat /etc/passwd, cat /etc/shadow for example).
> 
> Running the daemon as another user 
> 
> The fact that mysqld launches fine as root, but not as "mysql", if you
> have a 'mysql' local user (grep mysql /etc/passwd) indicates a
> permissions problem.
> 
> My mysqld process has a few temp files open, in /tmp, and a lot of stuff 
> in /var/lib/mysql/ open. 
> 
> I think you've alreaady checked it, but /var/lib/mysql/ and its files
> should be owned by "mysql"
> 
That is so.


> # chown -R mysql /var/lib/mysql
> # ls -ld /var/lib/mysql/
>  drwxr-xr-x  7 mysql mysql 4096 2006-05-29 14:11 /var/lib/mysql/
> 
> (your group might be different)
> 
> This might all be fine, I can't remember from earlier in the thread. 
> At one point, however, a log mentioned you had a problem writing to 
> "/root/tmp". If that directory is like mine
> 
> drwxr-xr-x  2 root root  4096 2006-01-11 07:32 tmp
> 
> Then that would mean the mysqld daemon couldn't run as anyhting but
> root. chmod 777ing this directory and launching mysqld as --user=mysql,
> and checking the log, would indicate if this were the problem (although
> that's not the final solution).
> 
> Of course it works now, but I alwasys think it's better to iron out
> potential problems earlier on :)
> 
I did indeed have some permissions problems which I think I have now
sorted out. One was the temp file mentioned above and another was
the /root folder. It seems strange to me that mysql should set itself
up needing to use certain folders and files and yet not have the
permissions set up accordingly.

Further checking shows me that mysql is now started at boot. Yes, I
know I can stop that from happening, but I don't mind because I plan to
use it quite a bit in the future. I presume that the installation set
all that up because I certainly didn't ask for it. (To remind you I use
Mandriva2006 and I installed mysql using the 'Configure your computer'
then 'Install software packages' options.)

Anyway, I use at as a normal user, and I can shut the server down as
normal user too. I hope that all is now working safely.

Neil Winchurst

> -- 
> The Mailing List for the Devon & Cornwall LUG
> http://mailman.dclug.org.uk/listinfo/list
> FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html

-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html