Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
all files on my system now owned by root
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
amped
n00b
n00b


Joined: 07 Sep 2005
Posts: 4
Location: Auckland, New Zealand

PostPosted: Mon Oct 09, 2006 5:19 am    Post subject: all files on my system now owned by root Reply with quote

So I was moving my partitions around, and I wanted to move my system to a new partition. I thought the following would work fine:
Code:
cp -r /mnt/oldroot/* /mnt/newroot

Turns out, I was wrong. All files on my system are now root:root.
I can still log in as a user, but I can't startx unless I'm root. I can't even su to root - gotta log out and in again.
Is there an easy fix for me, or am I looking at a reinstall?
Any ideas appreciated :)
_________________
I was predestined to some awful doom
Back to top
View user's profile Send private message
Hagar
Guru
Guru


Joined: 11 Feb 2003
Posts: 445

PostPosted: Mon Oct 09, 2006 5:30 am    Post subject: Reply with quote

If you still have the old partition you could try a combination of find and chown --reference
Back to top
View user's profile Send private message
defenderBG
l33t
l33t


Joined: 20 Jun 2006
Posts: 817

PostPosted: Mon Oct 09, 2006 5:48 am    Post subject: Reply with quote

well... you could change back the ownership to yourself... start kde (for gnome etc dont know)
go to /home/"username", click on it with the right mouse then choose Properties, second tab is Permissions. on user write your username, group: users, then select Apply changes... and click ok.

have fun, but be warned, that there might be some directories and files, left with root ownership...
Back to top
View user's profile Send private message
amped
n00b
n00b


Joined: 07 Sep 2005
Posts: 4
Location: Auckland, New Zealand

PostPosted: Mon Oct 09, 2006 7:21 am    Post subject: Reply with quote

thanks for the ideas - I don't have the original partition anymore though.

I chowned my home directory back, but I still can't su, and startx still fails (trying to move /var/log/Xorg.log to Xorg.0.log)
I suspect there will be quite a number of other problems I haven't encountered yet.. it's not looking good.
_________________
I was predestined to some awful doom
Back to top
View user's profile Send private message
baeksu
l33t
l33t


Joined: 26 Sep 2004
Posts: 609
Location: Seoul, Korea

PostPosted: Mon Oct 09, 2006 8:02 am    Post subject: Reply with quote

chown -R "user" /home/"user" (with maybe chgrp -R "users" thrown there too)

Shouldn't that work? If you've been a good user, you wouldn't have any files outside your home directory, right?

amped wrote:
I still can't su
You better check what groups your user is in.
_________________
Gnome:
1. A legendary being.
2. A never ending quest to make unix friendly to people who don't want unix and excruciating for those that do.
Back to top
View user's profile Send private message
jballou
Tux's lil' helper
Tux's lil' helper


Joined: 10 Mar 2005
Posts: 128
Location: Baghdad, Iraq

PostPosted: Mon Oct 09, 2006 8:52 am    Post subject: Reply with quote

Ugly spot to be in. If all else fails, you could always
emerge -e world
It'll fix all the binary permissions, then you just have to wade through config hell. Configs and directories will probably need to be manually reset but that should fix most of the issues. Any service/daemon related users will probably need their stuff set up again. But the world rebuild and chown ${USER}:users /home/${USER} -R should fix you up right as far as your personal stuff.
_________________
-Shuttle SN25P, Opteron 185, 74Gb WD Raptor, 2x 300Gb Barracuda 7200.9, 2x 1Gb Corsair dual channel, BFG GeForce 7800GT
-Asus Z7100 laptop, P-M 2.13, 2Gb DDR, 100Gb 7200RPM HDD, 128Mb GeForce 6600 Go.
Back to top
View user's profile Send private message
defenderBG
l33t
l33t


Joined: 20 Jun 2006
Posts: 817

PostPosted: Mon Oct 09, 2006 11:56 am    Post subject: Reply with quote

well edit /etc/group
search the line and edit it:
wheel:root,gentoo,<type your username here> (dont use space after the ,)

save and have fun :)
Back to top
View user's profile Send private message
widan
Veteran
Veteran


Joined: 07 Jun 2005
Posts: 1512
Location: Paris, France

PostPosted: Mon Oct 09, 2006 2:58 pm    Post subject: Re: all files on my system now owned by root Reply with quote

amped wrote:
I thought the following would work fine:
Code:
cp -r /mnt/oldroot/* /mnt/newroot

Turns out, I was wrong. All files on my system are now root:root.

Too late for this time, but next time add "-a" to preserve permissions.
amped wrote:
I can still log in as a user, but I can't startx unless I'm root. I can't even su to root - gotta log out and in again.

The main problem you have is not the file ownership, but the fact you removed the setuid/setgid bits from the permissions. X and su both need to be setuid root to work (X because it needs access to hardware, su because it needs to be able to read /etc/shadow, which can only be read by root).

Try to put the proper permissions again on all those files, and see if it helps:
Code:
  6228   44 -rws--x--x   1 root     root        41352 Jul  2 01:00 /bin/su
  6208   36 -rws--x--x   1 root     root        35312 Jul  2 01:05 /bin/ping
  6111   72 -rws--x--x   1 root     root        70984 Jul  2 00:51 /bin/mount
  6172   32 -rws--x--x   1 root     root        31080 Jul  2 01:05 /bin/ping6
  6240   48 -rws--x--x   1 root     root        45728 Jul  2 01:00 /bin/passwd
  6198   40 -rws--x--x   1 root     root        37504 Jul  2 00:51 /bin/umount
 20565   48 -r-xr-s--x   1 root     man         45792 Jul  2 00:53 /usr/bin/man
205523 1718 -rws--x--x   1 root     root      1753632 Jul 22 19:13 /usr/bin/Xorg
 16941   36 -rws--x--x   1 root     root        34536 Jul  2 01:00 /usr/bin/chfn
 16942   36 -rws--x--x   1 root     root        33000 Jul  2 01:00 /usr/bin/chsh
241166   12 -rws--x--x   1 root     root        11520 Aug 20 13:44 /usr/bin/lppasswd
 16943   44 -rws--x--x   1 root     root        42480 Jul  2 01:00 /usr/bin/chage
 21409   12 -rwxr-s--x   1 root     tty         11208 Jul  2 00:51 /usr/bin/write
250284  172 -rwxr-s--x   1 root     uucp       172184 Aug 20 14:14 /usr/bin/minicom
 20589   24 -rws--x--x   1 root     root        22656 Jul  2 01:00 /usr/bin/expiry
 20831   28 -rws--x--x   1 root     root        25792 Jul  2 01:00 /usr/bin/newgrp
 20838   44 -rws--x--x   1 root     root        41336 Jul  2 01:00 /usr/bin/gpasswd
  7506   20 -r-s--x--x   1 root     root        18120 Feb  9  2006 /usr/sbin/unix_chkpwd
  7544   16 -rws--x--x   1 root     root        14552 Jul  2 01:05 /usr/sbin/traceroute6
214447   16 -rws--x---   1 root     apache      13128 Jul 23 17:44 /usr/sbin/suexec2

Those are the files with setuid and/or setgid there are in /bin, /usr/bin, /sbin and /usr/sbin.
Back to top
View user's profile Send private message
amped
n00b
n00b


Joined: 07 Sep 2005
Posts: 4
Location: Auckland, New Zealand

PostPosted: Mon Oct 09, 2006 9:10 pm    Post subject: Reply with quote

Hey thanks widan - that seems to have fixed it!
I can now use su and startx as a user again!
Hopefully there won't be too many other problems caused by this.. can you think of anything else offhand?
_________________
I was predestined to some awful doom
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum