Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!rpi!uupsi!grebyn!macom1!larry From: larry@macom1.UUCP (Larry Taborek) Newsgroups: comp.unix.questions Subject: Re: changing gid and uids Message-ID: <5449@macom1.UUCP> Date: 3 May 90 13:49:32 GMT References: <11615@unix.SRI.COM> Organization: CENTEL Federal Systems, Reston, VA. 22091-1506 Lines: 50 From article <11615@unix.SRI.COM>, by ric@ace.sri.com (Richard Steinberger): > I would like to change a set of uids and gids for users on one computer > so they will be the same as they are for the same users on a second > machine. (Eventually yellow pages may be set up, but not for another > few months). My question is this: If I just edit /etc/passwd, and > /etc/group, making the appropriate changes, do I need do anything else > (i.e., do I have to explicitly manipulate all affected users' files > to reflect this new state of affairs?)? Thanks for any responses. > > regards, > > ric steinberger > ric@ace.sri.com Yup, Files are actually stamped in their inode with the users uid number, not their name. When you do a 'ls' command, ls opens the passwd file and reads it and transposes the owner and group numbers with the appropriate names, thus appearing as if the files were stamped with the users name and group name. Simply chaning the uid in the passwd file will not do ANYTHING to change the uids of the files in the file systems that are already stamped with the origional uids. To properly change the passwd uid and file uids heres how I would do it. 1). Find all the files on the machine that belonged to user uid '101' (or what ever uid is the target to change the uid from), and change them to the new uid '102'. find / -user 101 -exec chown 102 {} \; Where 101 is the old user uid number and 102 is the new user id number. Make sure that 102 is a new unique uid and that no one else has this number. (If they do, then that owner will own their own files and all these new files and you will have to figure out how to split them up later). 2). Delete the fred uid entry in the passwd file (which in our example is 101) and change it to be 102. Hope this helps... Larry -- Larry Taborek ..!uunet!grebyn!macom1!larry Centel Federal Systems larry@macom1.UUCP 11400 Commerce Park Drive Reston, VA 22091-1506 My views do not reflect those of Centel 703-758-7000