create/write permission denied – mysql/mariadb/libman etc. – howto fix broken linux filesystem permissions with valid backup

after a reboot i could not start mysql anymore.

[ERROR] mysqld: Can't create/write to file '/usr/local/var/mysql/aria_log_control' 

after a while i noticed that man was not working anymore:

man-db: error while loading shared libraries:

slowly i started to understand that something serious did happen to the system. after executing

chmod o+x .

from / directory, also inside /lib/ and /lib/mysql/ and yes, man and mysql did work again!

afterwards i executed something, that i SHOULDNT execute:

chmod -R 755 /sbin /usr/ /lib /lib64 /var

as someone recommended it as you can see in the link to fix permissionproblems, and my courier-auth-daemon did not start anymore, while mysql was running again.

after a reboot ssh did not let me in anymore, cause the private key had 755 aswell.

i realized that the ownership for / was not root anymore, but another user, cause of a malfunction of a php-script. i ended up syncing the permissions from a backup back to the system using the find command as described here:

be carfeul, it took me a lot of time, to get another backup, cause i missunderstood the commands of this link. it means

find . -exec chmod -v --reference='{}' /path/to/target/'{}' \;

copies the permissions from . (the folder you are in) to the /path/to/target/. – and not vice versa.

to copy the permissions from a target to the folder you’re currently inside, you need to use

find . -exec chmod -v –reference=/path/to/target/'{}’ ‘{}’ \;

…same as for chown….

so, in general: if you run into mysql-permission-problems check the rights of the entire hirachy and the owner of / ! this may help!

1 1 vote
Article Rating
Benachrichtige mich bei
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x