Solved

Change the UID

Posted on 2008-10-02
10
443 Views
Last Modified: 2012-05-05
How do I change the UID of a user on Unix
0
Comment
Question by:jdenver47
  • 3
  • 3
  • 2
  • +1
10 Comments
 
LVL 45

Expert Comment

by:sunnycoder
Comment Utility
Hello jdenver47,

 usermod  -u  

Regards,

sunnycoder
0
 
LVL 40

Accepted Solution

by:
omarfarid earned 500 total points
Comment Utility
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
Comment Utility
I have tried this but the user have some of the processes running and also he is accesing the NFS mounts..
0
 
LVL 45

Expert Comment

by:sunnycoder
Comment Utility
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
Comment Utility
why do you need to change the user id?
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

Author Comment

by:jdenver47
Comment Utility
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
Comment Utility
vipw
0
 

Author Comment

by:jdenver47
Comment Utility
Does Anyone has a script to do this...
0
 
LVL 45

Expert Comment

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

Expert Comment

by:ckozloski
Comment Utility
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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.:

763 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now