0

While trying to fix mySQL I seem to have made a huge mistake running sudo chmod -R 777 / var/lib/mysql which seemed to have change everything to green folder instead of purple and now even files like sudo won't work.

I am logged onto SSH as a root user. How do I become the "owner" and able to access all the files again?

  • Your Question says sudo chmod -R 777 / var/lib/mysql. The space between / and var is important. It's the different between a destroyed system (/ var) and a recoverable system (/var). Please review your Question for typos. Pay close attention to that critical space. – user535733 Aug 08 '21 at 01:27
  • If the space is indeed in the command your only options are to reinstall WITHOUT formatting or to restore a full system backup – Rinzwind Aug 08 '21 at 01:29
  • Unfortunately I had the space in.

    Isn't someone the "owner" that has access to everything? How can this be so devastating?

    – Julien Rodger Aug 08 '21 at 01:35
  • In general, you cannot. Your recursive chmod changed the permissions for each file from what they were, to 777. There isn't a single permission to set them back to, and you didn't keep track. – waltinator Aug 08 '21 at 01:57
  • My mistake of trying to fix a crash myself despite being pretty noobish instead of paying for someone to do it.

    I still don't get how accidentally making everything "readable, writable and executable by all users" made me unable to go places, it sounds more like it would open more files if anything.

    – Julien Rodger Aug 08 '21 at 02:20
  • The question linked by steeldriver does a good job of summarizing why setting rwx on every file and directory breaks a *NIX system. Be very careful with recursive commands and do not change ownership or permissions of system files unless you are aware of the consequences. – Nmath Aug 08 '21 at 03:22

0 Answers0