PDA

View Full Version : [gnome] Root owns my home



ST3ALTHPSYCH0
December 18th, 2009, 03:53 AM
Well, I attempted to move my home folder to another partition (just the folder, not a full /home partition). I didn't think and used sudo to create the directory that I move my home folder to and not root owns my home folder.
I tried making myself the owner again:


chown -R user.user /media/sdb1/home
chown: changing ownership of `/media/sdb1/home/.gvfs : function not implemented
sudo chown -R user.user /media/sdb1/home
chown: cannot access `/media/sdb1/home/.gvfs : Permission denied
[code]

So then I tried dropping to a root prompt and trying again:
[code]
sudo -s
chown -R user.user /media/sdb1/home
chown: cannot access `/media/sdb1/home/.gvfs : Permission denied


This isn't a huge deal for me due to the fact that I'll be reinstalling to new HDDs this weekend (I will migrate my home folder from my primary install to a separate /home partition in the process), but I would like to learn to fix this. I was going to have 3 different versions of Ubuntu installed and have the home folder like this in a home partition: /user (our Karmic install), /jaunty/user, and /lucid/user. I think that I'll just make the username of my other installs jauntyuser and luciduser so that they generate separate home folders from the word "go".

aysiu
December 18th, 2009, 03:58 AM
It probably worked. .gvs is always a bit troublesome with the chown command.

On a random note, for future reference, you should use
sudo -i and not sudo -s to get a persistent root prompt.

ST3ALTHPSYCH0
December 18th, 2009, 04:20 AM
It still lists root as the owner... what else can I try. BTW, what's the difference between the -s and -i modifiers? -s was the first one I found.

aysiu
December 18th, 2009, 04:31 AM
sudo -i gives you root privileges but uses the root environment.


sudo -s gives you root privileges but uses the user environment, so there is a danger in accidentally changing ownership of a user-owned file to root.

ST3ALTHPSYCH0
December 18th, 2009, 06:47 AM
Oh, I see. Thanks for the info.
Is there any other way to switch folder ownership if that didn't work?

JBAlaska
December 18th, 2009, 06:58 AM
You can always do it the GUI way. Start up a powerful file manager like krusader in root mode, right click on your /home dir, goto properties and change group=root and user=root to group=user user=user (where user is your user name ..duh..). all done.

ST3ALTHPSYCH0
December 18th, 2009, 07:06 AM
I might give that a try. Nautilus wouldn't let me do it (yes, I was running a root file browser).

CharlesA
December 18th, 2009, 07:10 AM
Strange. Try sudo -i and then run chown -R user:user /media/sdb1/home/(user)

Root should own the /home folder.

sisco311
December 18th, 2009, 07:12 AM
I might give that a try. Nautilus wouldn't let me do it (yes, I was running a root file browser).

Reboot in Recovery Mode and run:

chown user\: /home/user/.gvfs
chmod 0700 /home/user/.gvfs

~/.gvfs is the mount point for virtual filesystems, you can not change the permissions/owner while something is mounted in the directory.

ST3ALTHPSYCH0
December 18th, 2009, 07:23 AM
Ah, that makes sense. I assume that I need to substitute my current path for my home directory?

sisco311
December 18th, 2009, 07:26 AM
Ah, that makes sense. I assume that I need to substitute my current path for my home directory?

Yes.

EoRaptor013
June 15th, 2010, 04:39 AM
You can always do it the GUI way. Start up a powerful file manager like krusader in root mode, right click on your /home dir, goto properties and change group=root and user=root to group=user user=user (where user is your user name ..duh..). all done.
Wish it were so easy. Using nautilus (which is pretty "powerful"), when I click on the dropdown lists to change owner and group, the values revert to root and plugdev when I exit the field. You simply can't change the owner/group in nautilus, thunar, or bsc (yes, I started them with gksu).

Arrgh!