Linode Forum Index Linode Forum
Linode Community Forums
 


Accidentally changed group at root level

Click here to go to the original topic

 
       Linode Forum Index -> General Discussion
Author Message
enzipher



Joined: 18 May 2011
Posts: 2

Posted: Sat Dec 31, 2011 7:00 am    Post subject: Accidentally changed group at root level  

Hi all,

I believe i messed things up and would greatly appreciate some input...

I wanted to change group on a directory in public_html but instead ran the command at root level, recursively of course. I got a few "Operation not permitted" errors, but most files and directories now has the group www-data.

This is the command that was executed:
Code: # chgrp -R www-data /srv/www/example.com/public_html/media *

Is this a FUBAR situation, ie start from scratch or can I rectify this somehow by setting the group to root recursively or something?

Thanks,
Back to top  
theckman



Joined: 27 Nov 2010
Posts: 45

Posted: Sat Dec 31, 2011 7:12 am    Post subject:  

Was this command ran as root?
Back to top  
KyleXY



Joined: 27 May 2011
Posts: 4

Posted: Sat Dec 31, 2011 7:12 am    Post subject:  

Assuming you ran this command as the root user, you're s*** out of luck. Time for a backup and reimage of your Linode.
Back to top  
hoopycat



Joined: 30 Aug 2008
Posts: 1294
Location: Rochester, New York

Posted: Sat Dec 31, 2011 8:33 am    Post subject:  

Create a Linode in the same datacenter, restore your latest good backup to it, boot up the rescue mode, then:

Code: backup# find / -xdev -printf "chgrp %g %p\n" > /tmp/doh.sh

Copy /tmp/doh.sh over to your broken node and:

Code: failboat# sh /tmp/doh.sh

It should get most everything. You'll want to check for the stragglers with:

Code: failboat# find / -xdev -group www-data




If you don't have a backup, you're FUBAR.
Back to top  
rsk



Joined: 24 Nov 2009
Posts: 306

Posted: Sat Dec 31, 2011 9:30 am    Post subject:  

Wow, that's a nice trick, hoopycat... gotta remember this.
(Yes, I do backups.)
Back to top  
jebblue



Joined: 23 May 2010
Posts: 112

Posted: Sat Dec 31, 2011 12:24 pm    Post subject:  

hoopycat wrote:

Code: backup# find / -xdev -printf "chgrp %g %p\n" > /tmp/doh.sh



That is an amazing trick, very cool, will have to remember that.
Back to top  
hoopycat



Joined: 30 Aug 2008
Posts: 1294
Location: Rochester, New York

Posted: Sat Dec 31, 2011 5:57 pm    Post subject:  

I suppose I might as well mention that I haven't actually tried this, so it may or may not work. But it looks like it does. (find is generally amazing.)
Back to top  
enzipher



Joined: 18 May 2011
Posts: 2

Posted: Sun Jan 01, 2012 2:51 am    Post subject:  

Thanks for the replies. The answers were pretty much what I expected, although I had hoped for something else. As it stands I just signed up with Linode and got things up an running, so backups are nonexisting. For the data it's no problem, it's just that I have to redo the setup all over again, but I guess that is a good learning experience.

That I used the root account was a correct assumption by the way.

Anyways, thanks again. I am sure I will have reasons to come back to the forums, which I have actually followed since I sign up. Despite the setback I am really happy with Linode and the service. Everything went really smooth up until yesterday.

Cheers
Back to top  
 
       Linode Forum Index -> General Discussion
Page 1 of 1