Fastest Ways to Break Linux: chown of death

Have you ever wondered how to break Linux real fast? Here is a great example:

I mounted an external drive where you usually do (actually just /mnt … I was lazy). Also, I had previously used that EXT4 volume with my ParagonEXTFS driver on OSX (which, by the way, is terrible). To rectify the permissions, I wanted to do a recursive chown because naturally, everything on the drive should be owned by me.

sudo chown -R nick:nick /mnt/* /mnt/.*

Seems benign enough, right? Nope. So in trying to change the hidden folders (the .AppleDouble and .bullcrap) simultaneously, I didn’t realize in my tired stupor that this would cause it to match “..” or the directory above me. So naturally, it went back up to / and started chowning everything in my whole drive to my user and also wiping all the setuid bits necessary for sudo to function.

There is also no easy “fix-permissions” binary in Linux. I ended up just wiping and reinstalling.

Don’t do this. 🙂

Also, my first Linux botch was:

sudo chmod 770 /

back before I understood the difference between ./ and / which promptly destroyed the whole install. Thankfully that can be resolved by booting to live CDs. This one is not that easy 😉

Leave a Reply