I accidentally chmodded the file system root - how can I revert this?

3

I am using Ubuntu 11.04.

I mistyped and wrote sudo chmod 444 / instead of writing /home.

Everything went blank and icons started disappearing, and now when I try to run Ubuntu, it hangs on the initial Ubuntu sign.

I know that I have changed the permissions for root itself, but is there any way I can revert back?

user57162

Posted 2011-10-25T19:07:48.127

Reputation: 266

Answers

5

If you've only chmod'ed you root directory:

In linux, use chmod 755 to restore correct root directory access rights.

In Mac OS X, the sticky bit must be set, too. Use chmod +t / if you've already corrected the rights to 755. If not, you can do both at once using chmod 1755 /.

For both systems: Don't forget sudo if necessary.

Jens Erat

Posted 2011-10-25T19:07:48.127

Reputation: 14 141

Thanks a lot :) Entered this in the root prompt and everything got recovered .... – user57162 – 2011-10-25T19:24:13.880

Did chmod / once for educational reasons and took me quite some while to figure out the sticky but stuff. :) – Jens Erat – 2011-10-25T19:27:25.513

-1, / is not supposed to have the sticky bit set. It's only for /tmp. – user1686 – 2011-10-25T19:43:50.063

1@grawity Looks you're right, it isn't set on my linux boxes either. You need it on OS X machines, I misconcieved this would be the same in linux. Will edit my answer. – Jens Erat – 2011-10-25T19:55:52.030

Interesting. I'm curious why OS X uses it... – user1686 – 2011-10-25T21:14:31.573

2@grawity: it's because OS X allows the admin group write access to /, and without the sticky bit an admin could do nasty things like rename & replace top-level dirs without needing to go through any special authentication (sudo or the like). – Gordon Davisson – 2011-10-25T23:00:53.400

2

You may be able to boot into single user mode/rescue mode at the initial grub bootloader
If that doesn't work you can use an ubuntu or other boot disk such as Knoppix to boot your system, mount the / fs and correct it.
This is assume you did chmod 444 / not chmod -R 444 /

freedenizen

Posted 2011-10-25T19:07:48.127

Reputation: 509

1Good call on the recursion switch... let's hope you're right. – andyortlieb – 2011-10-25T19:14:24.057

how do i boot in the rescue mode ? And yes i did did the first one not the second – user57162 – 2011-10-25T19:14:57.090

Can you still get to a shell at all? Do you still have one open? – andyortlieb – 2011-10-25T19:17:15.003

Okayz things have changed ... went into recovery mode and then clicked on drop to root shell prompt ... Can you tell me what should i now enter to correct everything ? – user57162 – 2011-10-25T19:19:39.687

root is normally 755, so if you can do chmod 755 / that should restore it to a normal state – freedenizen – 2011-10-25T19:30:37.133