[OT] How to fix a stupid chmod mistake without rebooting

Thorny thorntreehome at gmail.com
Sat Mar 28 13:59:41 UTC 2009


On Fri, 27 Mar 2009 23:45:30 -0400, Matthew Flaschen posted:

> For reasons I'm not entirely clear, / was world-writable on a machine (not
> the whole computer, just /). So I blithely ran:
> 
> sudo chmod go-rwx /
> 
> (note, no -R, I'm not *that* dumb).
> 
> to correct it (can't be giving out permissions willy nilly!).
> 
> Then, to admire my handiwork I did:
> 
> ls
> zsh: command not found: ls
> 
> That's odd... (repeat ls several times in hope results will change). Start
> typing /bi hit tab to complete instinctually, zsh auto-complete prints
> errors like: (eval):3: permission denied: /dev/null
> 
> Finally realize what is happening (almost)
> 
> Try:
> 
> su
> 
> to go to root to fix it.
> 
> zsh: command not found: su
> 
> So by this point I am rather unhappy, and wondering if I'm going to break
> out a rescue CD.  But of course, I had root enabled on this machine, so I
> finally remembered the virtual terminal (already running login) could save
> me:
> 
> Login as root.  Enter:
> 
> sudo chmod a+rx /
> 
> Save the day.
> 
> Lessons (pick any two)
> 
> 1. Keep root enabled
> 2. sudo will not stop you from making stupid decisions. 3. Don't run sudo
> chmod a-rwx /
> 

Scary!

I can't write from experience because I have never tried anything like
that. However, I wonder why you didn't try "ugo" instead of just "go", it
is my understanding that one either uses "ugo" or 1, and only 1 of
the options. I also think that "a" is default if no option is used.

Glad you had the presence of mind to be logical and reason how to back out
of the situation.









More information about the ubuntu-users mailing list