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:

# 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,

7 Replies

Was this command ran as root?

Assuming you ran this command as the root user, you're shit out of luck. Time for a backup and reimage of your Linode.

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

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

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

failboat# sh /tmp/doh.sh

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

failboat# find / -xdev -group www-data

If you don't have a backup, you're FUBAR.

Wow, that's a nice trick, hoopycat… gotta remember this.

(Yes, I do backups.)

@hoopycat:

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

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

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.)

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

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct