LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 11-11-2013, 03:36 PM   #1
rustyz82
Member
 
Registered: May 2004
Posts: 69

Rep: Reputation: 15
Question chmod -R 777 /* and consequences


So I had a new developer working on a new VM with RHEL on it and they typod a chmod command and accidentally executed chmod -r 777 /* via sudo and it seems to have messed something up. We can't login remotely, the GUI on the console won't seem to take anyone to a desktop, it just keeps coming back to the login screen. I can't even choose a console login from the GUI login prompt, as it bounces back to the GUI login screen after a minute or so.

I have not taken it down to single user mode yet as I thought I would get some suggestions on how to proceed and potential damage caused. It looks like chmod command has some protection built in when doing recursive actions against / but obviously something is still messed up.
 
Old 11-11-2013, 03:49 PM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Its impossible (or very close to it) to restore all the files and directories to their original settings.

There's just one thing you can do: Restore the environment from a valid source. I hope you made snapshots and/or system and data backups.
 
Old 11-11-2013, 04:44 PM   #3
lpallard
Senior Member
 
Registered: Nov 2008
Posts: 1,045

Rep: Reputation: Disabled
Considering the OP refers to a VM, Id think the best and fastest way to recover is to restore from a VM backup.

More importantly, that brings the question: how often are you backing up your machines?

One of the advantage about VM's is how easy you can backup/restore if something goes wrong...
 
Old 11-12-2013, 02:13 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,356

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
If you can get it down to single user mode in cli mode you could try http://www.cyberciti.biz/tips/reset-...ermission.html
 
Old 11-12-2013, 10:55 AM   #5
rustyz82
Member
 
Registered: May 2004
Posts: 69

Original Poster
Rep: Reputation: 15
I was able to get it into single user mode, but given the extend of the repairs (over 900 individual packages) and the time involved vs rebuilding the server I have proceeded to rebuild the server. Once its rebuild I will make a snapshot.. which I had not done. Since these are sandbox VM's we were not actively making snapshots but I think that will change soon. Thanks for your help!
 
Old 12-21-2013, 06:43 PM   #6
rch
Member
 
Registered: Feb 2003
Location: Santa Clara,CA
Distribution: Mandriva
Posts: 909

Rep: Reputation: 48
Quote:
Originally Posted by rustyz82 View Post
So I had a new developer working on a new VM with RHEL on it and they typod a chmod command and accidentally executed chmod -r 777 /* via sudo and it seems to have messed something up. We can't login remotely, the GUI on the console won't seem to take anyone to a desktop, it just keeps coming back to the login screen. I can't even choose a console login from the GUI login prompt, as it bounces back to the GUI login screen after a minute or so.

I have not taken it down to single user mode yet as I thought I would get some suggestions on how to proceed and potential damage caused. It looks like chmod command has some protection built in when doing recursive actions against / but obviously something is still messed up.
One of our lead developers had a full sudo access to our main DB server- and he ran the 'chmod -r 777 /' command. As you can probably expect, nothing was working. This was a production database- and we needed it to be back as soon as possible.

These are the first steps to do:
http://unix.stackexchange.com/questi...d-777-problems

Next, restores all permissions as it was when the original RPMs were installed. Note that this can be dangerous- as sometimes it is necessary to change permissions for some applications to function.
Quote:
for p in $(rpm -qa); do rpm --setperms $p; done
for p in $(rpm -qa); do rpm --setugids $p; done
Next step fix problems due to the previous steps. And finally fix permissions for all everything else manually.
 
  


Reply

Tags
chmod, login, rhel



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
'chmod 777 [Foldername] -R' what is this? skinney Linux - Server 10 10-14-2012 11:50 AM
chmod 777 and 7777 presarioch Linux - Newbie 4 06-17-2008 01:24 PM
chmod 777 664 zerocool22 Linux - Server 7 06-03-2008 06:58 AM
CHMOD in shell : chmod 777 /usr/ <---is that right? cpanelskindepot Programming 5 07-16-2004 05:37 AM
chmod 777 /* ziggamon Linux - Newbie 2 09-25-2003 11:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 05:40 PM.

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