change uid

Rick Stevens rstevens at vitalstream.com
Fri Jan 19 00:47:16 UTC 2007


On Fri, 2007-01-19 at 10:23 +1100, Yuandan Zhang wrote:
> 
> 
> On 19/01/07, Rick Stevens <rstevens at vitalstream.com> wrote:
>         On Fri, 2007-01-19 at 08:32 +1100, Yuandan Zhang wrote:
>         >
>         >
>         > On 19/01/07, Yuandan Zhang <yuandan.zhang at gmail.com> wrote:
>         >         Hi,
>         >
>         >         I need to change a uid on  a client PC in order to
>         access nfs
>         >         of a server. The uid at local client is 500, that is
>         3000 on
>         >         the server. How to change it?
>         >
>         >         I googled and found niutil can do it, but it seems
>         works  on 
>         >         Mac OS. Is there equivalent tool on linux?
>         
>         As root, run "usermod -u 3000 name-of-user"
> 
> Thanks, that works. one more thing,  in order to login gnome desktop,
> the temp files at /tmp  related to this user must be remove 

Well, actually any files OUTSIDE the user's home directory must be
"chowned" to the new UID (and that includes the /tmp files).  When you
do such things as changing a user's UID, you should scan through the
filesystem(s) and change the ownership of the files owned by the user in
question.  A command that'd do that would be (again, as the root user):

	find / -u 500 -exec chown 3000 \{\} \;

with the "500" representing the users OLD UID, and "3000" representing
the user's NEW UID.  The "usermod" command will take care of the user's
home directory and anything under it, so run the find command after
doing the usermod command.  The user's home directory and such will
already be owned by the new UID, so the find command won't modify them
again.

----------------------------------------------------------------------
- Rick Stevens, Senior Systems Engineer     rstevens at vitalstream.com -
- VitalStream, Inc.                       http://www.vitalstream.com -
-                                                                    -
-    Overweight:  When you step on your dog's tail...and it dies.    - 
----------------------------------------------------------------------




More information about the fedora-list mailing list