Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Change the UID

Posted on 2008-10-02
10
Medium Priority
?
462 Views
Last Modified: 2012-05-05
How do I change the UID of a user on Unix
0
Comment
Question by:jdenver47
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +1
10 Comments
 
LVL 45

Expert Comment

by:sunnycoder
ID: 22624159
Hello jdenver47,

 usermod  -u  

Regards,

sunnycoder
0
 
LVL 40

Accepted Solution

by:
omarfarid earned 2000 total points
ID: 22624272
if you want to change the user id (the number then use

usermod -u new_uid login_name

If you want to change the user login name then use

usermod -i new_login_name login_name (this is current user login name)

OR

you may edit the /etc/passwd /etc/group and /etc/shadow files and do the required changes (which you should do carefully)
0
 

Author Comment

by:jdenver47
ID: 22624551
I have tried this but the user have some of the processes running and also he is accesing the NFS mounts..
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 45

Expert Comment

by:sunnycoder
ID: 22624579
From the man page
>You must make certain that the named user is not executing any processes when this command is being executed if the user's numerical user ID is being changed.<
You need to ask the user to logout.
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 22624629
why do you need to change the user id?
0
 

Author Comment

by:jdenver47
ID: 22624743
We have set up an NFS mount and the mount is shared between Linix and AIX. The mount has an application which switches the users from one system to another. Both the systems have same user's. So one user wants to communicate with other, Its a fundamental thing that they need to have same UID and GID. But both are different
0
 
LVL 4

Expert Comment

by:ckozloski
ID: 22639547
vipw
0
 

Author Comment

by:jdenver47
ID: 22645749
Does Anyone has a script to do this...
0
 
LVL 45

Expert Comment

by:sunnycoder
ID: 22645990
Its a single command but you have to log off the user.
0
 
LVL 4

Expert Comment

by:ckozloski
ID: 22646039
if you use vipw, that will allow you to mid god and hid for whatever user you have on the box. You shouldn't need a script.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question