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.

I won't be the first and I won't be the last, I suppose. While playing around with the find command, I made a whoops and it would appear that instead of changing the permissions of the ~/web directory to 750, it changed the permissions of the entire filesystem (/) to 750, however I'm not certain, but any attempt to investigate is thwarted by Permission denied messages. For everything.

This was the offending command:

sudo find ~/web . type d -exec chmod 750 {}

If I'm not mistaken, the Ubuntu team disabled root logins as a safety precaution so I'm out of ideas.

I'm (obviously) a total newbie when it comes to file permissions so I was wondering if anyone had some good or even some bad advice to share. I've mentally prepped myself to losing everything on the computer which is only of mild consequence, since I have backups, but I did do a bit of work on this box over the week and it would be a shame to lose it all due to a boneheaded mistake.

If you are reading this message, ask yourself, have you backed up any of your work recently?

Thanks in advance for any insights. Feel free to scold me for using sudo carelessly

share|improve this question
    
Also, maybe this should be moved to Server Fault? I wasn't sure of which one to post to. –  Ouairz Jun 22 '12 at 1:18

1 Answer 1

up vote 3 down vote accepted

At this point, the only way I can think of that might help you is to do a reinstall without formatting.

However, you could try logging in, and then doing sudo -i which will give you root access. You could also do what is suggested here. Also, the serverfault guys suggest reinstalling as well, to that might just be your best option. :(

If you do a reinstall without formatting, make sure to log in via a tty and run the following:

sudo chmod -R 700 /home/YOUR_USERNAME && sudo chown YOUR_USERNAME:YOUR_USERNAME /home/YOUR_USERNAME. To find out what your username is, run whoami and it will tell you.

Then reboot, and you should be set.

Also, I don't think anyone here will scold you - I've done it once, I also did a sudo rm -rf /* on a production system once, so don't feel bad. :)

share|improve this answer
    
To be clear, reinstalling without formatting will preserve the /home folder but replace everything else, thus correcting my filesystem? Then I can log in via tty and use sudo to fix the faulty permissions on my /home folder. This makes a lot of sense, thank you for solving my problem. I'm really glad I moved the contents of /var/www to /home a long time ago... Really, a production system? ;) –  Ouairz Jun 22 '12 at 1:55
    
It will preserve the /home folder but replace everything else. And yes. Thankfully it was part of a new deployment and as such no data was lost, I just imploded the ec2 instance and started over. :P –  jrg Jun 22 '12 at 2:01
1  
Hey I read this askubuntu.com/questions/56051/… I'm going to try something based on that, think it's worth a shot? : 1- Boot from Ubuntu LiveCD and mount hard drive 2- sudo chown -hR ubuntu /path/to/home/ 3- sudo chmod 777 /path/to/home/ (to be safe, I'll fix it later) 4- save the fixed home folder to an external hard drive 5- do a complete format of the entire drive and this time, reinstall with two partitions: one for / and one for /home (THIS IS SO EXCITING) –  Ouairz Jun 22 '12 at 2:18
    
That should do the trick. Good luck! –  jrg Jun 22 '12 at 10:15

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.