Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I've just spent most of the day setting up an Ubuntu 12.10 server and I was really enjoying it. I was stupid enough to do:

sudo chmod 666 /*

instead of the equally suspect

sudo chmod 666 ./*

I can't use any programs on the system now

I havent yet set a root password so now I really wished I was on CentOS :'(

Is there anything I can do without starting again? Thanks in advance!

share|improve this question
1  
Just for future reference, you never need to use ./*, the simple * will suffice and is less prone to misstypings. –  terdon Mar 9 '13 at 13:37
add comment

1 Answer

up vote 5 down vote accepted

You have to boot from a live cd, because all your executables are not reachable in the moment (dropped access bit on directories /bin, ...).

Please do:

  1. boot from a live cd
  2. mount your system below mnt, don't forget to add additional mounts like /usr, /var, ...
  3. cd /mnt/
  4. for d in * ; do if [ -d ${d} ] ; chmod u+rwx,og+rx-w ${d}; fi
  5. chmod og= root lost+found # more restrictive permissions
  6. reboot your system and drink a beer :-)

caveat: This applies to the root directory / which normally consists only of subdirectories and symbolic links.

share|improve this answer
    
Thanks so much, I'm trying it now. I suppose that's such a logical solution I didn't really think of it! –  Cobolt Mar 9 '13 at 13:56
1  
@Cobolt - your welcome :-) Be happy and think what would have been happened if you also had added the -R switch to chmod ;-) –  user86064 Mar 9 '13 at 13:58
    
Worked like a charm! Thanks. I think it's time I learnt bash scripting, php/perl doesn't make me thing sys admin enough. Thanks again! –  Cobolt Mar 13 '13 at 8:02
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.