Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 11-14-2004, 08:16 AM   #1
LQ Newbie
Registered: Aug 2004
Posts: 4

Rep: Reputation: 0
Dumb ass newbie!

Ok, so I guess you've heard of a few stupid things in your time...

I've kinda messed up my system a little and I need some advice on how to get it back. To cut a long story short I accidentally ran

chmod -R 777 /
while logged in as root.

Needless to say, things started going wrong almost immediately, e.g. sshd won't even start if the files holding the public keys are world readable.

So what's the best way to undo this mess? I am thinking at the moment the best way to avoid future problems is to just reinstall from scratch.

Thanks, and I know I'm stupid.

OS: Fedora Core 3
Old 11-14-2004, 08:56 AM   #2
Registered: Feb 2004
Location: UK
Distribution: RHEL/Fedora, Solaris 11, NetBSD, MacOS
Posts: 223

Rep: Reputation: 42

Hi craigh,

Well, I guess you learnt the hard way that you've got to be careful what you're doing when you're root, and think before you type!

Anyway, if I didn't have anything special set up that I needed to save, I think I would do a fresh install too. Just to be sure. But if there is stuff that needs to be saved, then you could start by issuing

chmod -R 755 /
which would make everything readable, writable and executable by root, and readable and executable by everything else.

Then from there move onto specific folders, such as /etc in which pretty much every file has permissions of rw by root, and readable by everyone else

cd /etc
ls -l | grep -v ^d | cat > files.txt
would give you a list of all the actual files, and not the directories as these need to have different permissions. You could then at least use this file as a reference to know what files you need to change the permissions on, and if you reissue the command every so often, you'll be able to see how far you've got. You should also be able to see the files that should have different permissions, such as shadow and passwd, which should have permissions of 600 (rw by root, nothing for anybody else).

I'm sure there's probably a better way of doing this, but I don't know what it is.


Old 11-14-2004, 09:12 AM   #3
LQ Newbie
Registered: Aug 2004
Posts: 4

Original Poster
Rep: Reputation: 0
thanks SteveK1979,

i think you've pretty much confirmed what i was dreading...that there is no easy way out.

ironically, i executed that command from a python script i was writing to perform automatic backup of the system. i guess i now have the golden oppurtunity to test how good my backups are
Old 11-14-2004, 09:28 AM   #4
Registered: Feb 2004
Location: UK
Distribution: RHEL/Fedora, Solaris 11, NetBSD, MacOS
Posts: 223

Rep: Reputation: 42
At least you have backups!

But you're right, reinstalling is going to be the way to go.
Old 11-14-2004, 01:07 PM   #5
LQ Veteran
Registered: Mar 2003
Location: Boise, ID
Distribution: Mint
Posts: 6,642

Rep: Reputation: 85
At the risk of repeating what has already been said, your only option is a full reinstallation. The problem with recursive chmod commands is that they will universally reset the permissions to what you currently specify, which in no way necessarily corresponds to what they once might have been. To illustrate, if file "A" originally had permissions 644 and file "B" was 755, the initial "chmod 777" would change both A and B to 777 (obviously) at which point it would then become impossible to recover or even determine what their previous permissions had been.

I congratulate you on running regular backups, however, to be honest the only safe thing to do would be reinstall. I'll also echo SteveK1979's excellent advice about running as root - don't make this a habit. Root should only be used sparingly, and only in limited, specific situations (such as installing new packages, recompiling the kernel, etc). For day to day use, just use a regular user account -- J.W.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
really dumb, but not 4 a newbie GingerMegs Linux - Software 11 05-04-2005 06:42 AM
dumb mistake tej Linux - Newbie 1 09-01-2004 04:15 AM
screwed up fedora install - dumb mistake itsjustme Fedora 2 06-19-2004 04:54 AM
Really dumb mistake - need a MDK 9.2 boot disk Delmarc Linux - Newbie 4 03-18-2004 05:39 PM
DUMB Mistake: installed RH9 rpm's on RH8 system ToBe Red Hat 5 09-23-2003 02:22 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:25 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration