Results 1 to 7 of 7
There is inconsistency between UID's and GID's at different machines on my network. Therefore I have plenty of files where user group attributes are represented by numbers. For example:
Code:
...
- 02-08-2010 #1
[SOLVED] Consolidating UID's and GID's on the network
There is inconsistency between UID's and GID's at different machines on my network. Therefore I have plenty of files where user group attributes are represented by numbers. For example:
On my openSUSE machine /etc/passwd contains the following user definition:Code:-rw-r----- 1 503 702 25074 Jun 8 2005 wavescan.xml -rw-r----- 1 boris users 1803308 Jan 12 2007 measurement.csv
On my Fedora machine is the same user defined as:Code:boris:x:1000:100:Boris User:/home/boris:/bin/bash
And on the NAS this user is defined as:Code:boris:x:500:500:Boris User:/home/boris:/bin/bash
What would be the easiest way to consolidate UID's and GID's on all machines?Code:boris:x:503:702:Boris User:/home/boris:/bin/bash
- manualy editing /etc/passwd and /etc/group files
- using commands such as usermod, groupmod, chown, chgrp
What are potential risks of doing such such operation?
Any other thoughts/guidelines are welcome too.
I would prefer not to make some fatal mistakes here.Fedora 13, GNOME
HP Compaq NC6000, Intel Pentium M Processor 725, ATI Mobility Radeon 9600, Intel PRO 2200BG
HP Compaq DC7100, Intel Pentium 4 Processor 541, Intel 915G Express, D-Link DWL-510 AirPlus G
- 02-09-2010 #2Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,970
The only way to do this is with a directory server such as YP (Yellow Pages) or LDAP.
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 02-10-2010 #3
Yesterday I tried it out on my openSUSE machine.
I followed the instructions from Linux: Changing UIDs and GIDs for a user by Stuart Colville
These are the exact steps that I performed:
- su root
- init 1
- usermod -u 502 boris
- groupmod -g 702 users
- shutdown
- boot from gparted-liveCD
- mount local ext3 partitions (/ and /home)
- find . -user 1000 -exec chown -h 502 {} \; (executed on each partition)
- find . -group 100 -exec chgrp -h 702 {} \; (executed on each partition)
- check UID GID in /etc/passwd and /etc/group (manually correct if necessary)
I rebooted the machine and so far openSUSE works normally
. Also when I NFS mount my NAS, I'm really the owner of all remote files (this saves a lot of headache for me). Now I can do anything with my remote files as if I mounted a local partition.
For some reason the original instructions did not work out for me. I'm not sure why, but
took endless time, it never finished. After 1 hour of waiting, I decided to abort the operation. That is the reason why I had to continue from gparted-liveCD.Code:find / -user 1000 -exec chown -h 502 {} \;
The next step:
I have to do the same on my Fedora machine, only I'm not sure if SELinux will like this
.
There is only one way to find out!Fedora 13, GNOME
HP Compaq NC6000, Intel Pentium M Processor 725, ATI Mobility Radeon 9600, Intel PRO 2200BG
HP Compaq DC7100, Intel Pentium 4 Processor 541, Intel 915G Express, D-Link DWL-510 AirPlus G
- 02-11-2010 #4
Yesterday I fixed my other openSUSE machine.
The following will do all changes in the /etc/passwd and /etc/group.
After this manual editing is not needed any more. Besides usermod changes the ownership of the /home files too.Code:usermod -u 502 boris usermod -g 702 boris groupmod -g 702 users
Still I had to boot from gparted-liveCD to finish the job.
In order return the ownership of all previously owned files, following must be executed on each linux partition.
Once more the operation was successful, openSUSE system seems to work normallyCode:find . -user 1000 -exec chown -h 502 {} \; find . -group 100 -exec chgrp -h 702 {} \;
.
Fedora 13, GNOME
HP Compaq NC6000, Intel Pentium M Processor 725, ATI Mobility Radeon 9600, Intel PRO 2200BG
HP Compaq DC7100, Intel Pentium 4 Processor 541, Intel 915G Express, D-Link DWL-510 AirPlus G
- 02-11-2010 #5Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,970
That is good - basically what I was saying about the need to change user/group ids to a common set, and then modifying all related files/directories to the correct user+group. You will probably find stuff not working from time to time because of the files+directories that you missed. Also, if you add a user to your systems, you will have to deal with their uid/gid as well, though that is a lot easier when you first create them. One last thing, installing some software also installes a group and/or user, such as Oracle, which will install several of both such as users = (oracle), groups = (dba, oinstall, oper, oracle).
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 02-11-2010 #6
So far I'm the only user on this system, and this change is limited to that user only.
I hope that installing other software is not going to cause any problems. If that occurs I'll have to deal with it.
At this point in time, I'm only concerned about the user access to my NAS space. My goal is now achieved, at least for openSUSE machines the NAS issues are fixed.
(In one of the previous threads I discussed the problem of OpenOffice freezing when opening documents stored on the NAS. As a workaround I used to mount my NAS with nolock option. Now I don't have to do that since everything works normally.)Fedora 13, GNOME
HP Compaq NC6000, Intel Pentium M Processor 725, ATI Mobility Radeon 9600, Intel PRO 2200BG
HP Compaq DC7100, Intel Pentium 4 Processor 541, Intel 915G Express, D-Link DWL-510 AirPlus G
- 02-23-2010 #7
Fedora 13, GNOME
HP Compaq NC6000, Intel Pentium M Processor 725, ATI Mobility Radeon 9600, Intel PRO 2200BG
HP Compaq DC7100, Intel Pentium 4 Processor 541, Intel 915G Express, D-Link DWL-510 AirPlus G




