Page 1 of 1

Pesky permissions problem

PostPosted: Dec 30th, '13, 22:22
by mark9117
Not so much a problem as just an issue.

My HTPC was setup with a userid for me that is different than the userid on my desktop (desktop = 10001, htpc = 501). The shares on that htpc are mounted on the desktop with uid=10001,gid=10001. On the htpc it's mounted with defaults. This means that I have to either ssh directly into the pvr, or (gasp!) walk over the htpc to manage files, otherwise, I don't have permission to change/delete those files.

I could shuffle my user account on the htpc to make my uid 10001, but that would be work. I'm in a hurry and lazy. What say you? How is the best way to deal with this issue?

Thanks.

Mark

Re: Pesky permissions problem

PostPosted: Dec 30th, '13, 22:55
by doktor5000
How do you mount the shares? NFS? There's idmapd which is meant for things like that, but honestly, I don't like that stuff.

An existing user can pretty easily be changed via
Code: Select all
usermod -u NEWUID -g NEWGID username
and then simply
Code: Select all
chown -R username:groupname /home/username
as root - all that should be done in single-user mode so that no files are being accessed.

For other files you can simply use
Code: Select all
find / -uid OLDUID -exec chown username:groupname {} \;
to change ownership afterwards or first look for the files and write them in a logfile via
Code: Select all
find / -uid OLDUID -ls

You may need to run the find command also for -gid

Re: Pesky permissions problem

PostPosted: Dec 31st, '13, 10:28
by filip
Recently as I was trying to fix KDE login issue I didn' found solution yet but I found this neat shortcut:
Code: Select all
chown -R NEWUID:NEWGUID --from=OLDUID:OLDGUID /

Re: Pesky permissions problem

PostPosted: Dec 31st, '13, 19:00
by doktor5000
Please next time do not use fullquotes, but only use the Reply function. Greatly improves clarity and reading flow ;)

Shortcut for what? Do you want to run this over / ? Also you still have to change the UID of the user itself.
Will not work for files that only belong to users primary group or only belong to the user.

Re: Pesky permissions problem

PostPosted: Jan 1st, '14, 15:31
by filip
doktor5000 wrote:Shortcut for what?

For both of your examples of chown and find as with chown --from can all be done in one command. A bit brute force I admit but convenient non the less.

doktor5000 wrote:Do you want to run this over / ?

Yes. If UID or/and GUID are changed some directories outside of /home can stay with the old ID's. But as I said your method with two steps is safer.

doktor5000 wrote:Also you still have to change the UID of the user itself.

True.

doktor5000 wrote:Will not work for files that only belong to users primary group or only belong to the user.

Not necessarily. Either may be omitted, in which case a match is not required for the omitted attribute.


BTW doktor5000 I would appreciate very much if you can take a minute on my KDE login issue thread above.