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

Matthew Flaschen matthew.flaschen at gatech.edu
Sat Mar 28 03:45:30 UTC 2009


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 /

Matt Flaschen




More information about the ubuntu-users mailing list