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.
I've got some problems and to get them fixed, I changed the ownership on /usr from root to user. So many errors thrown afterward, while opening the VBs and basically could not login to root anymore! So the question is that how to get the ownership of /usr back to original, meaning from user's ownership to root ownership. Cause I run sudo -i and I get the operation is not permitted.
Have run the following command before the disaster!
chown -R USER /usr
Which distribution of Linux are you using? Did you have a separate root user which you created a password for or did you use sudo when logged in as your primary user?
Quote:
I've got some problems and to get them fixed, I changed the ownership on /usr from root to user.
Highly unlikely that would resolve whatever problems you had.
It's not that easy, the biggest issue is the suid/sgid bit which gets reset whenever owner is changed. The upshot of this is that even though you restore the owner to root:root, sudo or other commands relying on suid still won't work. Also not all files in /usr are owned by root:root, some are owned by root but have a different group - and this may break programs using these files and running under a non-root account. You are screwed big time. While theoretically there is nothing difficult in restoring corrupted access rights and SCO Unix even had such an utility called fixmog, I don't know of linux equivalent. Reinstall or install the same distro with the same packages, tar /usr, boot from live CD and extract it over your current /usr - tar preserves suid.
A lot of newbies get caught that way. It's one of the few problems that really need a reinstall. The bonus is that you won't do it again!
The problem is that people coming over from Windows don't immediately understand what file ownership and protections are for. They just seem like a nuisance, getting in the way of something you want to do, so changing them seems like a good solution. As lvm has pointed out, they are baked into the core of all Unix operating systems and should not be altered unless you know exactly what the consequences will be. If you need to manipulate those files, do it as root.
This will restore owner, group, permissions and capabilities of all files installed via package management system to the states they were in at the installation time.
For a DEB-based system, you may try something like
It's not that easy, the biggest issue is the suid/sgid bit which gets reset whenever owner is changed. The upshot of this is that even though you restore the owner to root:root, sudo or other commands relying on suid still won't work. Also not all files in /usr are owned by root:root, some are owned by root but have a different group - and this may break programs using these files and running under a non-root account. You are screwed big time. While theoretically there is nothing difficult in restoring corrupted access rights and SCO Unix even had such an utility called fixmog, I don't know of linux equivalent. Reinstall or install the same distro with the same packages, tar /usr, boot from live CD and extract it over your current /usr - tar preserves suid.
As you mentioned It was not that simple. To change back the ownership to root of the directory /usr was unsuccessful.
As I mentioned the operation was not permitted. So I was not even able to login to as a regular user so I had ought to do change thing on boot which I am not that much knowledgeable yet. SO you could guess I lost every info on my system, luckily had backup at some point but all rhcsa's resources for the exam is gone!
I installed Mint again which took me only 10 mins which is worth to skip that painful process of recovery. I got my lesson to not ever again change the ownership of root . That will ruin every program’s structure on my OS.
It's not that easy, the biggest issue is the suid/sgid bit which gets reset whenever owner is changed. The upshot of this is that even though you restore the owner to root:root, sudo or other commands relying on suid still won't work. Also not all files in /usr are owned by root:root, some are owned by root but have a different group - and this may break programs using these files and running under a non-root account. You are screwed big time. While theoretically there is nothing difficult in restoring corrupted access rights and SCO Unix even had such an utility called fixmog, I don't know of linux equivalent. Reinstall or install the same distro with the same packages, tar /usr, boot from live CD and extract it over your current /usr - tar preserves suid.
As you mentioned It was not that simple. To change back the ownership to root of the directory /usr was unsuccessful.
As I mentioned the operation was not permitted. So I was not even able to login to as a regular user so I had ought to do change thing on boot which I am not that much knowledgeable yet. SO you could guess I lost every info on my system, luckily had backup at some point, but all rhcsa's resources for the exam is gone!
I installed Mint again which took me only 10 mins which is worth to skip that painful process of recovery. I got my lesson to not ever again change the ownership of root . That will ruin every program’s structure on OS.
A lot of newbies get caught that way. It's one of the few problems that really need a reinstall. The bonus is that you won't do it again!
The problem is that people coming over from Windows don't immediately understand what file ownership and protections are for. They just seem like a nuisance, getting in the way of something you want to do, so changing them seems like a good solution. As lvm has pointed out, they are baked into the core of all Unix operating systems and should not be altered unless you know exactly what the consequences will be. If you need to manipulate those files, do it as root.
Thats totally true and I understand your point but as a newbie I would expect a warning on changing those critical settings as it not changing simply and ruins everything. I mean I love this OS, I have removed totally windows to focus on linux and its been couple of months I spend at least 5 hrs a day working on this OS but still a typo can ruin everything. I understand the point that it is a professional OS not for everyone but one should starts from somewhere and to be about to screwed like this needs at least a warning in forehand
By the way, I have installed Mint and some other programs again. The original problem was not being able to install guest addition on virtual box and I read some post on oracle website to change the permission on the /Virtualbox directory to get the guest addition run on VB. So changing the ownership on parent directory /usr cause that issue.
But the question remain. The ownership feature of thumb rule which inherits from parent directory to child directory how could it be resolved? Is that only root ownership which should not be touched?
This will restore owner, group, permissions and capabilities of all files installed via package management system to the states they were in at the installation time.
For a DEB-based system, you may try something like
Location: as far S and E as I want to go in the U.S.
Distribution: Fossapup64
Posts: 224
Rep:
Quote:
Originally Posted by nselx
Thats totally true and I understand your point but as a newbie I would expect a warning on changing those critical settings as it not changing simply and ruins everything. . . .
As some User's forum signature says, "Linux assumes the user knows exactly what he/she is doing," as I paraphrase.
Welcome! What you just did is somewhat of an initialization in Linux, as @hazel implies! LOL
Ken Thompson has an automobile which he helped design. Unlike most automobiles, it has neither speedometer, nor gas gauge, nor any of the other numerous idiot lights which plague the modern driver. Rather, if the driver makes a mistake, a giant “?” lights up in the center of the dashboard. “The experienced driver,” says Thompson, “will usually know what’s wrong.”
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.