Linux - NewbieThis 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!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.