Was trying to change the ownership of a folder but executed this command

root@xyz.com:~# chown -R www-data:www-data /              

The entire directory structure under '/' got changed. Upon realising the mistake I executed this command

root@xyz.com:~# chown -R root:root /                                    

Now I am unable to execute php scripts as apache user. Mysql is unable to find an existing database (shows 'unknown database'). Not sure what else got broken.

migrated from stackoverflow.com Nov 21 '18 at 6:42

This question came from our site for professional and enthusiast programmers.

  • 3
    You won't be able to fix that system since you have lost all the ownership information of the whole file system content. You might be able to still use parts of the system, but most services will run into issues and trying to fix all that by hand is something you do not really want to start with. So fetch the backups and start from the last point you wrote the backup. – arkascha Nov 21 '18 at 6:24
  • 1
  • there are no accidents with sudo. You were just subconsciously ready to rebuild this system from scratch. ;) – mnmnc Nov 21 '18 at 8:13

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.