Pesky permissions problem

This forum is dedicated to basic help and support :

Ask here your questions about basic installation and usage of Mageia. For example you may post here all your questions about getting Mageia isos and installing it, configuring your printer, using your word processor etc.

Try to ask your questions in the right sub-forum with as much details as you can gather. the more precise the question will be, the more likely you are to get a useful answer

Pesky permissions problem

Postby mark9117 » Dec 30th, '13, 22:22

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
Let's just reboot everything all the time.
User avatar
mark9117
 
Posts: 395
Joined: Sep 12th, '11, 20:32
Location: Eastern New Mexico -- Not Hell, but you can see it from here.

Re: Pesky permissions problem

Postby doktor5000 » Dec 30th, '13, 22:55

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
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18070
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Pesky permissions problem

Postby filip » Dec 31st, '13, 10:28

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 /
Last edited by doktor5000 on Dec 31st, '13, 18:57, edited 1 time in total.
Reason: removed fullquote
filip
 
Posts: 478
Joined: May 4th, '11, 22:10
Location: Kranj, Slovenia

Re: Pesky permissions problem

Postby doktor5000 » Dec 31st, '13, 19:00

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.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18070
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Pesky permissions problem

Postby filip » Jan 1st, '14, 15:31

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.
filip
 
Posts: 478
Joined: May 4th, '11, 22:10
Location: Kranj, Slovenia


Return to Basic support

Who is online

Users browsing this forum: No registered users and 1 guest