View previous topic :: View next topic |
Author |
Message |
urcindalo l33t
Joined: 08 Feb 2005 Posts: 623 Location: Almeria, Spain
|
Posted: Tue Dec 11, 2018 9:46 am Post subject: [solved] user id different from user gid. How to change? |
|
|
Hi everyone and thanks for reading this.
My Gentoo installation dates back from 2008, my username is ramiro and I have this issue: my user gid does not match my user id:
Code: | # id ramiro
uid=1000(ramiro) gid=1020 grupos=1020,6(disk),7(lp),10(wheel),12(mail),
18(audio),19(cdrom),27(video),80(cdrw),85(usb),100(users),250(portage),
22(sshd),16(cron),1001(crontab),106(lpadmin),1007(haldaemon),1008(plugdev),
1010(polkituser),1011(scanner),1014(vmware),105(boinc),998(android),
997(vboxusers) |
As you can see, gid is now 1020. Up until 10 minutes ago it was 1002, but 1002 belonged to ssmtp. So, I tried assigning ssmtp the gid 1020, to no avail. Now, the new ramiro gid is 1020 and ssmtp's is still 1000:
Code: | -rw------- 1 ramiro 1020 5745 dic 11 10:25 .bash_history
-rw-r--r-- 1 ramiro ssmtp 193 mar 19 2014 .bash_profile |
I also tried manually changing /etc/group, which now reads as shown, again to no avail (even after a restart "id ramiro" shows the info above):
Code: | ssmtp:x:1002:
ramiro:x:1000: |
This also happens to other users. For instance, user jacinto (which also dates back from 2008) has the gid belonging to crontab:
Code: | $ id jacinto
uid=1001(jacinto) gid=1001(crontab) grupos=1001(crontab),6(disk),7(lp),
10(wheel),12(mail),18(audio),19(cdrom),27(video),80(cdrw),85(usb),
100(users),22(sshd),16(cron),1007(haldaemon),1008(plugdev),
1010(polkituser),1011(scanner),1014(vmware),997(vboxusers) |
So, how can I get out of this mess?
Any help is appreciated.
Thanks very much in advance.
Wrapped long lines to make the forum layout behave. Also removed 'quote' tags from around the whole post, which made it look kind of weird, and was probably unintended. —Chiitoo
Last edited by urcindalo on Mon Dec 17, 2018 8:51 am; edited 1 time in total |
|
Back to top |
|
|
cboldt Veteran
Joined: 24 Aug 2005 Posts: 1046
|
Posted: Tue Dec 11, 2018 10:47 am Post subject: |
|
|
I have notes from doing this long ago, globally shifting a UID and a GID from 500 to 501 ...
Code: | cd /
find ./ -uid 500 -exec chown 501 "{}" \;
find ./ -gid 500 -exec chgrp 501 "{}" \;
edit /etc/passwd (e.g. cboldt:x:501:501:Real Name Here:/home/cboldt:/bin/bash)
edit /etc/group (e.g. cboldt:x:501:cboldt ) |
Those "edit" lines are not commands, but the "find" lines are commands.
Missing from instructions, I knew in advance there was no conflict with UID 501 or GID 501 - meaning those UID and GID were not used by any other. If there had been, the above method would have created a tangled mess as existing UID 500 and UID 501 (and GID 500 & GID 501) would have been combined/conflated on the filesystem. Undoing such a mess could be easy or difficult, depending on where the affected files were located. My UID/GID 500 mostly had files in /home/cboldt (aka, /home/UID-500), but also more than a few in /usr/local.
Note that chown and chgrp allow numeric assignments without those numeric assignments being defined in /etc/passwd or in /etc/group. The association made in /etc/passwd and /etc/group is what changes the `ls -l` showing of user and group from numeric to alphabetic.
Edit - unrelated remark ... I have no idea why the "code" section above uses so many columns, pretty much eliminating line wrap to display width. There are no trailing spaces or other wihitespace in the cut'n'paste. |
|
Back to top |
|
|
urcindalo l33t
Joined: 08 Feb 2005 Posts: 623 Location: Almeria, Spain
|
Posted: Mon Dec 17, 2018 8:50 am Post subject: |
|
|
Thanks for your help.
I had already "chgrp'ed" in the past, by newly created files still belonged to the wrong group. It didn't come to my mind I had to also check /etc/passwd. After I did my problem seems to be solved. |
|
Back to top |
|
|
Syl20 l33t
Joined: 04 Aug 2005 Posts: 619 Location: France
|
Posted: Fri Dec 21, 2018 4:52 pm Post subject: |
|
|
cboldt wrote: | I have notes from doing this long ago, globally shifting a UID and a GID from 500 to 501 ...
Code: | edit /etc/passwd (e.g. cboldt:x:501:501:Real Name Here:/home/cboldt:/bin/bash)
edit /etc/group (e.g. cboldt:x:501:cboldt ) |
|
The usermod and groupmod commands are preferable. |
|
Back to top |
|
|
Jaglover Watchman
Joined: 29 May 2005 Posts: 8291 Location: Saint Amant, Acadiana
|
|
Back to top |
|
|
|
|
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
|
|