On 13/07/2022 12:00, steve-ALUG@hst.me.uk wrote:
Hi All
Due to some historical ineptitude, I have ended up with this situation.
On my Server, I have UserA, with User ID 1001, and Group ID 1001.
On my main laptop, I have
User A UID 1001 GID 1002 User B UID 1002 GID 1001
I've just discovered this. Now, when I open files on a NFS share, they're shown on my laptop as owned by User A, Group User B, despite the server thinking they're both User A.
On my laptop, I need to change the group IDs round in the /etc/group file so they're consistent with the user IDs. I also need to change any files legitimately owned by User A or User B to have the "correct" group ID.
User A is my main laptop user. I have got another - User C I can login as.
I suspect, what I'll have to do is
Login as User C
#something like...
#change files gid 1001 to gid 4444 sudo find {magic to find Gid 1001} {exec's strange syntax to} chmod :4444 "the file"
#change files gid 1002 to gid 1001 sudo find {magic to find Gid 1002} {exec's strange syntax to} chmod :1001 "the file"
#change files gid 4444 to gid 1002 sudo find {magic to find Gid 4444} {exec's strange syntax to} chmod :1002 "the file"
Then I'll need to change the GID numbers somehow in the Group file. The simplest way I can think of is just edit the file, save it, then immediately reboot.
Before I do this, can anyone see any GOTCHA!s?
Any suggestions or advice please?
Hi Steve,
I've had to do similar a few times (also ineptitude in the past, and adding different people to different machines, while having an NFS store in the middle).
Gotchas: - everything will be weird until the users log off/on again. - you should re-mount the NFS to drop caches (or restart machine). - files on the server need processing too if there are any from userB
Process: - as suggested, go via a non-affected user C, do the sudo/su dance as appropriate for your setup. - use 'vigr' (and 'vigr -s') to update the group files so that you have the IDs allocated as desired (using vigr tell the kernel to re-cache) - unless you know there are files outside user home folders (unlikely), do not attempt a find/chgrp, simply apply a recursive change to the home folder # cd ~userA # chgrp -R userA . # cd ~userB # chgrp -R userB . - safest to restart the machine, and check all is as you expect :)
- if you want to try a find/chgrp.. here's the magic I know: # find / -mount -group <gname> -print0 |xargs -0 chgrp <newgname>
from the root, without crossing mount points (you might omit this
if you're sure the NFS mount isn't there!), find files with the specified group name or number, spit 'em out with \0 separators to avoid pain with white space in file names. Pipe to xargs which expects \0 separators, then runs chgrp to the required group name in large (efficient) blocks.
Cheers, P.
On 13/07/2022 15:59, Phil Ashby wrote:
On 13/07/2022 12:00, steve-ALUG@hst.me.uk wrote:
[good advice]
Cheers, P.
Thanks!
Steve
PS MODERATORS,
I've just sent a message from a different email account by mistake. I got a "post from a non-member" email message. Previously these had a link to "cancel" the posting, so moderator's time was not wasted. That's not there any more. Given that I am a prize numpty and several of my posts go from the wrong account, and not wanting to waste your time, can that feature be reinstated?
On Thu, Jul 14, 2022 at 02:40:44PM +0100, steve-ALUG@hst.me.uk wrote:
PS MODERATORS,
I've just sent a message from a different email account by mistake. I got a "post from a non-member" email message. Previously these had a link to "cancel" the posting, so moderator's time was not wasted. That's not there any more. Given that I am a prize numpty and several of my posts go from the wrong account, and not wanting to waste your time, can that feature be reinstated?
It's probably related to the mailing list software upgrade, I'll mention it. However you could probably subscribe the other address too and then set it to not receive any mail and then it wouldn't matter which address you replied with.
Adam --