Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Today I ran sudo chmod -R a-wrx /. Now nothing is working. Can anyone help me recover my system?

share|improve this question
add comment

2 Answers 2

Basic answer

If you are comfortable with scripting you could:

  1. do a clean install on another machine.
  2. use a script to extract the entire file directory and annotate it automatically with all its permissions (for instance, /usr/bin/sh 0755 [I am just making something up here])
  3. use that list to apply the same permissions on your messed up installation.

Or of course a clean install is possible.

BTW: Who told you to issue that command?

More Information (edit)

I actually just found a really nice script that uses the same logic. As the author says, be careful before using it and don't if you are not sure you know what it does: http://superuser.com/questions/132891/how-to-reset-folder-permissions-to-their-default-in-ubuntu-9-10

To help you on the way (from the source mentioned above):

find /etc /usr /bin -exec stat --format "chmod %a ${MPOINT}%n" {} \; > /tmp/restoreperms.sh
share|improve this answer
1  
+1 That's a really good idea. Although (like mine) it's premised on Ubuntu even letting the OP back in. –  BryceAtNetwork23 Mar 7 '13 at 13:52
2  
@BryceAtNetwork23 That's why one should always keep a live, rescue or installation CD for their distribution and version of choice handy. Makes everything so much simpler when you really mess up. –  Michael Kjörling Mar 7 '13 at 14:27
add comment

I would almost say that you might have to do a clean re-install here. There are many iterations of directories off of the system root that are required for Ubuntu (Linux) to run properly. If their permissions are messed-up, you will need to re-chmod everything. That's assuming of course that it even lets you log back in.

If you wanted to try to recover, you may be able to accomplish this as the root user. To get in as root, reboot and hold SHIFT immediately after BIOS posts. That should get you into your GRUB menu.

From the GRUB menu, select your most recent kernel tagged with "(recovery mode)." Once that finishes loading, you should be presented with a menu that has an option to "drop to root shell prompt."

If it works and logs you in as root, you should be able to chmod your system back into working order.

share|improve this answer
    
If OP manages to get logged in, then a chmod -R a+rwx / will at least give access to all files. But that's only the start. Ouch, this one really had me cringing ... –  zwets Mar 7 '13 at 13:45
    
@zwets, yes that was my thought, too. –  BryceAtNetwork23 Mar 7 '13 at 13:49
    
@Nanne point taken. –  BryceAtNetwork23 Mar 7 '13 at 14:00
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.