Archive for the tag 'write'

SBDavid

Sharing Write Permission

Sharing Write Permission

For more than one user to be able to write to the same directory it will be necessary to grant write permission to a group they share in common. The following example grants shared write permission to /var/www to the group “webmasters”.

sudo chgrp -R webmasters /var/www
sudo find /var/www -type d -exec chmod g=rwxs “{}” \;
sudo find /var/www -type f -exec chmod g=rws “{}” \;

EXAMPLES

chgrp staff /u
Change the group of /u to “staff”.

chgrp -hR staff /u
Change the group of /u and subfiles to “staff”.

MySQL database does not work and returns “Can’t create/write to file” error

The problem is related to the mysql directory permission.

‘mysql’ user is not able to create a temporary file in /var/lib/mysql/ directory due to permissions lack

# ls -lda ~mysql/

drwxr-xr-x 5 root mysql 4096 Aug 31 09:56 /var/lib/mysql/

The solution is to go to /etc/init.d/mysqld_app_init file and change

chown root.mysql /var/lib/mysql

to

chown mysql.mysql /var/lib/mysql

Then restart mysqld service or just change owner of /var/lib/mysql directory to “mysql” instead of “root”

chown root /var/lib/mysql