1832907 Members
3416 Online
110048 Solutions
New Discussion

UID

 
brian_31
Super Advisor

UID

Hi All:

I am running a script in an NIS environment which would create a user with a uid 9902(hardcoded). Now to install this code into the production box, we found that the box already has this uid(9902). I would like to know what would be the impact of modifying the uid now and how? Please advise.

Thanks
Brian.
6 REPLIES 6
Shahul
Esteemed Contributor

Re: UID

Hi

If U change the UID of an existing user, It affect's his file permissions and owner ships. Better U duplicate the UID or go for a new UID.

Best of luck
Shahul
Pete Randall
Outstanding Contributor

Re: UID

I really don't think you want to have duplicate uid's. Change the existing user, then do a chown -R on his home directory to reset ownership. Or, to be more thorough, do a find -user to get a list of all files beforehand, then use the list as input to your chown.

Pete

Pete
PIYUSH D. PATEL
Honored Contributor

Re: UID

Hi,

If you change the uID now then the user cannot aceess the files which were created using the old UID, file permissions are changed.

So you should be very careful before changing the UID.

Piyush

MANOJ SRIVASTAVA
Honored Contributor

Re: UID

Hi Brian


You can also give a simple id command to verify waht the id is , though it is suppose to eb unique but if u ahve two user ahving sam uid then there can problems for all teh coomand related to the access , previlages where the OS cehcks for the id apart from the permisiions and acces for the files too.


Manoj Srivastava
Paula J Frazer-Campbell
Honored Contributor

Re: UID

Brian

Whilst duplicate UID can be set up it can cause major problems and is highly inadvisable.


A quick and dirty check on files/ dirs owned by 9902 is :-


ll -R | awk '{print $3,$4,$9}' | grep 9902

Run it from root dir as root for a full check.

If a file has 9902 in its name then this will be collected as well.


Paula

If you can spell SysAdmin then you is one - anon
A. Clay Stephenson
Acclaimed Contributor

Re: UID

I suppose I am being stupid but it's probably easier to change your NIS script to use another uid. You definitely don't want two user's sharing the same UID. Plan B is to do a find for uid 9902 and a -exec chmod {} newuid \; before running your script. I hope that you don't have a set of applications that depend upon a hard-coded uid because that is start-of-the-art dumb.
If it ain't broke, I can fix that.