Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 465
  • Last Modified:

Change the UID

How do I change the UID of a user on Unix
0
jdenver47
Asked:
jdenver47
  • 3
  • 3
  • 2
  • +1
1 Solution
 
sunnycoderCommented:
Hello jdenver47,

 usermod  -u  

Regards,

sunnycoder
0
 
omarfaridCommented:
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
 
jdenver47Author Commented:
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!

 
sunnycoderCommented:
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
 
omarfaridCommented:
why do you need to change the user id?
0
 
jdenver47Author Commented:
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
 
ckozloskiCommented:
vipw
0
 
jdenver47Author Commented:
Does Anyone has a script to do this...
0
 
sunnycoderCommented:
Its a single command but you have to log off the user.
0
 
ckozloskiCommented:
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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now