LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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



Reply
 
Search this Thread
Old 03-12-2006, 07:46 AM   #1
oskar
Senior Member
 
Registered: Feb 2006
Location: Austria
Distribution: Ubuntu 12.10
Posts: 1,138

Rep: Reputation: 49
Talking 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 01:14 PM.
 
Old 03-12-2006, 08:38 AM   #2
kevkim55
Member
 
Registered: Dec 2005
Location: Edmonton
Distribution: BLFS, Gentoo
Posts: 353

Rep: Reputation: 32
Boot with an installtion CD and run chown root on the directory ?
 
Old 03-12-2006, 01:12 PM   #3
BinJajer
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
Blog Entries: 1

Rep: Reputation: 30
Sit down and cry? Use a livecd? Chown back to root?
 
Old 03-12-2006, 04:26 PM   #4
J.W.
LQ Veteran
 
Registered: Mar 2003
Location: Milwaukee, WI
Distribution: Mint
Posts: 6,642

Rep: Reputation: 69
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
 
Old 03-12-2006, 11:25 PM   #5
oskar
Senior Member
 
Registered: Feb 2006
Location: Austria
Distribution: Ubuntu 12.10
Posts: 1,138

Original Poster
Rep: Reputation: 49
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.
 
Old 03-13-2006, 01:19 AM   #6
J.W.
LQ Veteran
 
Registered: Mar 2003
Location: Milwaukee, WI
Distribution: Mint
Posts: 6,642

Rep: Reputation: 69
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.
 
Old 03-18-2006, 01:02 PM   #7
oskar
Senior Member
 
Registered: Feb 2006
Location: Austria
Distribution: Ubuntu 12.10
Posts: 1,138

Original Poster
Rep: Reputation: 49
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.
 
Old 03-18-2006, 02:10 PM   #8
prasanta
Member
 
Registered: Mar 2005
Location: India
Distribution: Debian
Posts: 368

Rep: Reputation: 37
Try with a live cd. chroot to the partion and change the ownership rights.
 
Old 03-18-2006, 09:54 PM   #9
KimVette
Senior Member
 
Registered: Dec 2004
Location: Lee, NH
Distribution: OpenSUSE, CentOS, RHEL
Posts: 1,794

Rep: Reputation: 46
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 09:57 PM.
 
Old 03-19-2006, 06:38 PM   #10
oskar
Senior Member
 
Registered: Feb 2006
Location: Austria
Distribution: Ubuntu 12.10
Posts: 1,138

Original Poster
Rep: Reputation: 49
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
insmod looking in the wrong place Recirqie Linux - Software 0 10-20-2004 04:38 PM
sorry, kinda wrong place sriontoc General 3 09-29-2004 09:28 PM
modprobe looking for modules in the wrong place? Jaster150 Slackware 20 09-20-2004 10:59 PM
!forgive me if this is wrong place pudhiyavan Linux - Hardware 7 04-19-2004 02:45 AM
lilo in wrong place, help! krgue Linux - Software 4 05-22-2001 05:32 PM


All times are GMT -5. The time now is 02:37 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration