Score:0

How do I reverse chmod 777?

in flag

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?

user535733 avatar
cn flag
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.
cn flag
If the space is indeed in the command your only options are to reinstall WITHOUT formatting or to restore a full system backup
Julien Rodger avatar
in flag
Unfortunately I had the space in. Isn't someone the "owner" that has access to everything? How can this be so devastating?
waltinator avatar
it flag
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.
Julien Rodger avatar
in flag
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.
Nmath avatar
ng flag
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.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.