List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:October 18 1999 9:36pm
Subject:[MySql not respecting /etc/group settings and not seeing databases]
View as plain text  
>>>>> "aaron" == aaron  <aaron@stripped> writes:

>> Description:
aaron> I have a database directory symboically linked from the datadir into a client
aaron> directory. The client directory and files are owned by webserv and www-data
aaron> and the permissions are 2770 for the entire tree exept for the root (/www)
aaron> which is set for 2775. Underneath of /www there are many client directories
aaron> in the following format:
aaron> /www/www.foobar.com
aaron> /www/www.foobar.com/docs
aaron> /www/www.foobar.com/database
aaron> etc...
aaron> The directories are owned by the client, i.e. foo and grouped by www-data.
aaron> This allows clients to only have access to their directories among other
> things.
aaron> Via settings in /etc/group the webserver and the mysql server (user mysql) have
aaron> access. with the above directory stucture grouped, 2770 owned by foo and
> grouped
aaron> by www-data the foo account and the mysql account can write delete files and
aaron> directories.  The mysql server however doesn't recognize that the database
aaron> exists. If I chmod the entire directory tree above the destination directory:
aaron> /www/www.foobar.com/database/TestDB_DIR then the mysql server recognizes the
aaron> directory as a database.

>> How-To-Repeat:
aaron> create a directory to be used as a mysql database.
aaron> symbollicaly link from your datadir into that directory.
aaron> set the file and directory permissions to 770.
aaron> create a system user that can access that directory via
aaron> /etc/group settings.
aaron> verify that your mysql account can access that directory
aaron> to write/delete files and directories.
aaron> do a mysql show databases and it won't be found.
aaron> chmod the entire directory tree to 775.
aaron> do a mysql show databases and it will now be found.

aaron> observe the cut-n-pastes below:
aaron> -------------------------------

aaron> from /etc/group:
aaron>  mysql:x:34:webserv,foo,www-data
aaron>  www-data:x:33:[...],mysql

aaron> from /etc/init.d/mysql.server (symbolic link to
> /usr/local/share/mysql/mysql.server)
aaron>  mysql_daemon_user=mysql # Run mysqld as this user.
aaron>  datadir=/usr/local/mysql

aaron> from /usr/local/mysql
aaron> lrwxrwxrwx   1 mysql    mysql          39 Oct 18 11:16 fooTest ->
> /www/foobar.com/database/fooTest/


aaron> notorious:/# 
aaron> drwxrwsr-x   7 webserv  www-data     1024 Oct  7 09:51 www

aaron> notorious:/www# 
aaron> drwxrws---   7 foo      www-data     1024 Oct 13 13:13 foobar.com

aaron> notorious:/www/foobar.com#
aaron> drwxrws---   4 foo      www-data     1024 Oct 18 11:16 database

aaron> notorious:/www/foobar.com/database# 
aaron> drwxrws---   2 foo      www-data     1024 Oct 18 11:20 fooTest


aaron> notorious:/www/foobar.com/database# su - mysql
aaron> $
aaron> $ pwd ; ls -l ; touch test ; ls -l ; rm test; ls -l
aaron> /www/foobar.com/database/fooTest
aaron> total 0
aaron> -rw-rw-r--   1 mysql    www-data        0 Oct 18 11:59 test
aaron> total 0
aaron> -rw-rw-r--   1 mysql    www-data        0 Oct 18 12:00 test
aaron> total 0


mysql> show databases;
aaron> +----------+
aaron> | Database |
aaron> +----------+
aaron> | mysql    |
aaron> | test     |
aaron> +----------+
aaron> 2 rows in set (0.00 sec)


aaron> notorious:/# chmod -R 2775 www
mysql> show databases;
aaron> +----------+
aaron> | Database |
aaron> +----------+
aaron> | fooTest  |
aaron> | mysql    |
aaron> | test     |
aaron> +----------+
aaron> 3 rows in set (0.00 sec)

<cut>

Hi!

What did I miss?

(/my/data) ls -ld /www/
drwxrws---   3 root     my           1024 Oct 19 00:24 /www/
(/my/data) ls -ld /www/foobar.com/
drwxrws---   3 root     my           1024 Oct 19 00:24 /www/foobar.com/
(/my/data) ls -ld /www/foobar.com/database/
drwxrws---   3 root     my           1024 Oct 19 00:24 /www/foobar.com/database/
(/my/data) ls -ld fooTest
lrwxrwxrwx   1 monty    my             32 Oct 19 00:26 fooTest ->
/www/foobar.com/database/fooTest
(/my/data) mysqlshow
+----------------+
|   Databases    |
+----------------+
| fooTest        |
+----------------+

The server is run as 'monty' and is group 'my'.
I am running Linux 2.2.10 on RedHat 5.2  (gcc 2.0).

Regards,
Monty
Thread
[MySql not respecting /etc/group settings and not seeing databases]aaron18 Oct
  • [MySql not respecting /etc/group settings and not seeing databases]Michael Widenius19 Oct