Linux - Newbie This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
 |
03-12-2006, 06:46 AM
|
#1
|
|
Senior Member
Registered: Feb 2006
Location: Austria
Distribution: Ubuntu 12.10
Posts: 1,142
Rep:
|
I own everything! (did 'chown -R' in the wrong place)
I have to mount my exchange harddisk as root, don't know why.
So I have to change the user permissions to get access. In a moment of cleverness I did chown instead of chmod, to be more specific:
Code:
chown -R --from=root 'me' /
In the mount directory
as a result I can't even log in as root anymore
Code:
$ su
pwd:
su: cannot set groups: operation not permitted
so...
what do I do?
I can do chown as user now, but it doesn't seem to work properly that way.
Last edited by oskar; 03-12-2006 at 12:14 PM.
|
|
|
|
03-12-2006, 07:38 AM
|
#2
|
|
Member
Registered: Dec 2005
Location: Edmonton
Distribution: BLFS, Gentoo
Posts: 353
Rep:
|
Boot with an installtion CD and run chown root on the directory ?
|
|
|
|
03-12-2006, 12:12 PM
|
#3
|
|
Member
Registered: Sep 2005
Location: Warsaw, Poland
Distribution: Slackware 10.2, Caldera OpenLinux 3.1, Corel Linux (Thanks xhi!), Debian GNU/HURD etc...
Posts: 296
Rep:
|
Sit down and cry? Use a livecd? Chown back to root?
|
|
|
|
03-12-2006, 03:26 PM
|
#4
|
|
LQ Veteran
Registered: Mar 2003
Location: Boise, ID
Distribution: Mint
Posts: 6,642
Rep:
|
Recursively changing permissions of ownership of files is not something that has an "undo" option, and unfortunately I would say that your only option is to reinstall.
To illustrate the problem, once permissions or ownership has been changed, there's no way to restore the previous value, and thus, if you have 200 files in a certain directory and some of them were owned by root, others by user A, and others by user B, after the chown operation they'll all show under the one single user. How can you tell which ones previously belonged to root, or A, or B? You can't, hence the only safe thing to do is reinstall.
Reinstalls aren't that big of a deal though, assuming that you've made /home in its own partition. If so, just make sure to leave /home as is (do not reformat it). You should be back up and running pretty quickly. Good luck with it
|
|
|
|
03-12-2006, 10:25 PM
|
#5
|
|
Senior Member
Registered: Feb 2006
Location: Austria
Distribution: Ubuntu 12.10
Posts: 1,142
Original Poster
Rep:
|
Quote:
|
Originally Posted by J.W.
To illustrate the problem, once permissions or ownership has been changed, there's no way to restore the previous value, and thus, if you have 200 files in a certain directory and some of them were owned by root, others by user A, and others by user B, after the chown operation they'll all show under the one single user. How can you tell which ones previously belonged to root, or A, or B? You can't, hence the only safe thing to do is reinstall.
|
Well... I only changed the files and directories belonging to root. So that should be reversible.
I promised myself not to work on it till wednesday (I have two tests in between). But I think I should be able to chown back. I am able to longin as root with the 'rescue-system' - option.
chown - man:
Code:
--from=CURRENT_OWNER:CURRENT_GROUP
change the owner and/or group of each file only if its current
owner and/or group match those specified here. Either may be
omitted, in which case a match is not required for the omitted
attribute.
|
|
|
|
03-13-2006, 12:19 AM
|
#6
|
|
LQ Veteran
Registered: Mar 2003
Location: Boise, ID
Distribution: Mint
Posts: 6,642
Rep:
|
Quote:
|
Originally Posted by oskar
Well... I only changed the files and directories belonging to root. So that should be reversible.
|
Maybe I'm not understanding your question. To illustrate, suppose you have 3 files, one (file "A") owned by root and the other two (files "B" and "C") owned by user. If you chmod so that they all three are owned by user, then you have no way of determining that file "A" originally was owned by root. Consequently, if you later peform another chmod on these same three files to set everything back to being owned by root, then you'll end up with "B" and "C" being owned by root, which is just as bad.
|
|
|
|
03-18-2006, 12:02 PM
|
#7
|
|
Senior Member
Registered: Feb 2006
Location: Austria
Distribution: Ubuntu 12.10
Posts: 1,142
Original Poster
Rep:
|
yes, but I chmodded with the '--from' option (see above).
But anyways, it didn't work. Looks like I have to re-install. Wich is not that bad, I can now rethink my partitioning.
Well it is bad, I have to redo so much crap, but at least I'll remember to do a system backup.
Thanks everybody.
|
|
|
|
03-18-2006, 01:10 PM
|
#8
|
|
Member
Registered: Mar 2005
Location: India
Distribution: Debian
Posts: 368
Rep:
|
Try with a live cd. chroot to the partion and change the ownership rights.
|
|
|
|
03-18-2006, 08:54 PM
|
#9
|
|
Senior Member
Registered: Dec 2004
Location: Lee, NH
Distribution: OpenSUSE, CentOS, RHEL
Posts: 1,794
Rep:
|
That stinks!
You could chown root:root -R / however as others pointed out some services (apache, mysql, bind, etc.) depend on file ownership for proper secure operation, particularly chrooted apps. Unfortunately your best course is to back up /home and /etc (and /var/lib/mysql, /var/srv or /var/www, etc.) and then reformat/reinstall.
But look at it this way: you're wise enough to realize that this is a problem. I have (er, HAD, and good riddance!) a client who INSISTS on chmod -R 777 / on his OS/X boxes - and he wonders why he used to get hacked all the time (and I heard they are getting pwned again).
Why did he do this? They love MacOS's total lack of security, and HATE security (and yet they want a secure network? HA!). They know better and they do it anyway. We lost them because we would not agree to open up their boxes, just specific shares for moving files. They view security as inconvenient, despite their boxes having been repeatedly hacked in the past. Last I heard from friends who work there, they're back to the shenanigans and get hacked regularly. Sad thing is they do work for the Navy and a fortune-100 company. If they were ever to get audited for security by either client, they'd lose their bread-and-butter contracts instantly.
Last edited by KimVette; 03-18-2006 at 08:57 PM.
|
|
|
|
03-19-2006, 05:38 PM
|
#10
|
|
Senior Member
Registered: Feb 2006
Location: Austria
Distribution: Ubuntu 12.10
Posts: 1,142
Original Poster
Rep:
|
Quote:
|
Originally Posted by prasanta
Try with a live cd. chroot to the partion and change the ownership rights.
|
Thanks for pointing out 'chroot' didn't know that one.
The chowning back does work, but something is still broke. Kde refuses to start in normal mode, I guess due to my configuration files now belonging to root. Anyway, I'll re-install, who knows what else is broke. I'd rather spend two hours re-configuring than repairing and risking an unstable system.
@KimVette - I didn't like the whole security thing at first, but after a few months I realized that I didn't have a single virus or been attacked once, even though I have apache and aMule running all the time. That more than justifies all the sudo chown and chmod stuff.
---
This is a great support group here, I appreciate the lack of 'RTFM!' and the whole closing, editing and deleting - threads stuff that seems to be pretty popular elsewhere.
|
|
|
|
All times are GMT -5. The time now is 05:59 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|