LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   su: cannot set groups: Operation not permitted (https://www.linuxquestions.org/questions/linux-newbie-8/su-cannot-set-groups-operation-not-permitted-770498/)

myretribution79 11-20-2009 03:06 PM

su: cannot set groups: Operation not permitted
 
Hi all. This is my first post.

Yesterday I used chown to change every file and folder from /var/www/mysite to my user, but instead of typing * I typed /* and i chowned all my folder/files from /bin to /proc to this user instead of root or whatever user it was before.

Now I can't su - into the system or sudo.

When I use su - it throws "su: cannot set groups: Operation not permitted" and if I sudo it says "sudo: /etc/sudoers is owned by uid 500, should be 0"

What I tried so far is:
chmod ugo+s /etc/passwd
chmod ugo+s /etc/group
chmod ugo+s /bin/su

chmod 4755 /etc/passwd
chmod 4755 /etc/group
chmod 4755 /bin/su

Please help. I'm desperate.

Thank you.

sarum1990 11-20-2009 04:20 PM

for starters, since you own everything, I'd recommending changing the ownership of everything in etc to root, as it usually is. After that you should at least be able to sudo again. sifting through the rest of your system for permissions will be more tricky. On my system there is only one file, mpd.conf, in my /etc directory that isn't owned by root so this should be a good start. If that fails you'll have to start up a recovery cd, like the one you used to install linux to fix the problem.

myretribution79 11-20-2009 04:28 PM

but that's the problem.

nothing seems to work

-bash-3.2$ chown root:root /etc
chown: changing ownership of `/etc': Operation not permitted


BTW, it's a centos 5.4 server installation and it's an actual live dedicated server on which I connect with putty.

myretribution79 11-21-2009 07:21 AM

anyone?

sarum1990 11-21-2009 06:37 PM

The next step would usually be booting to a livecd and mounting your hardrive after you boot, then, since your just mounting your local filesystem on an unbroken system you should be able to change the permissions. Most livecds have a rescue functionality which will drop you into a terminal as root, from which you should be able to change the permissions.

Hope this helps.

myretribution79 11-22-2009 03:32 AM

Thanx for the replies.

Like I said, it's a dedicated server. So I can't use any CD/DVD, since I'm thousand of kilometers away from the server ;)

Anyway, I asked my hosting company to reload the OS, because even if I change all the permissions to root it still won't work properly because not all files/folders need to be owned by root.


All times are GMT -5. The time now is 05:49 AM.