User id modification


 
Thread Tools Search this Thread
Operating Systems Solaris User id modification
# 1  
Old 01-04-2011
User id modification

Dear All,

Some of the users having the same user id and group id in my /etc/passwd file.

Now I want to change the users to have a unique user id and group id.

How can we do that. If I change this will it affect the running applications.

Rgds
Rj
# 2  
Old 01-04-2011
Use:
Code:
usermod -u new_uid username

It might affect applications. If the user owns some directories or files on the server, then you will have to manually fix ownership on them, as after the change they will be owned by the old UID.
# 3  
Old 01-04-2011
The only safest way would be to have one of these users to be logged out and to have no process running. Then you'll be able to modify its account ids and then change the ownership of its home directory tree. There might be issues with files that user owns in common directories like /tmp and /var/tmp as there would be no implicit way to sort out the real owner. Beware also of files stored in archives / backups as the owner would also be wrong.
# 4  
Old 01-04-2011
Run something like this after you change the users uid to see if any files that were owned by the old uid and change them using the second command.

make note of the users uid before you change it.

Code:
find / -user olduid

This will search the entire system for all files that were owned by that user which will now be owned by the old uid.
now change ownership of the file that is owned by the old uid to the new username
Code:
chown user:group filename

# 5  
Old 01-04-2011
Java

Just as a thought, it may be worth it to change BOTH users to new uids. You'd have to change all the files owned by either user to the appropriate new uid. But six months from now, when you find a file that is owned by the now disabled user, you will know to ask both users who it belongs to.
This User Gave Thanks to m.d.ludwig For This Post:
# 6  
Old 01-05-2011
Hi All

Thanks for all ur replies.

Rgds
Rj
# 7  
Old 01-05-2011
Quote:
Originally Posted by sboots
Run something like this after you change the users uid to see if any files that were owned by the old uid and change them using the second command.

make note of the users uid before you change it.

Code:
find / -user olduid

This will search the entire system for all files that were owned by that user which will now be owned by the old uid.
now change ownership of the file that is owned by the old uid to the new username
Code:
chown user:group filename

The problem is the OP has multiple users that have the same uid, so there's no way to automatically assign one uid to another since there's no context-free mapping.

For any given file, you can't really know which new user to assign the file ownership to because there's more than one possibility with no way to figure out which one is correct. You can probably assume if it's under the user's home directory that it's owned by that user, and maybe some other context-specific information is available, but in general there's no way to tell.

jlliagre's post didn't explicitly state that issue. FWIW, I like m.d.ludwig approach of giving all the users with overlapping uids new uids.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

cp modification

I'm usia Raspbian, a Debian subset, and wondering what work would be involved in altering the cp command. cp at present needs a full path and file name for source and at least full filename for destination. How can I change this so the second parameter isn't needed? So if the destination... (6 Replies)
Discussion started by: MuntyScrunt
6 Replies

2. Shell Programming and Scripting

How to do user-preset login to Bash shell then automate path modification?

How do a user login with full user-environment preset to Bash shell then automatically do path modification with few script codes, either on command-line or put it in a script file. what i tried: bash --login -c PATH="/ANewPath:${PATH}" bash --login -c 'PATH="/ANewPath:${PATH}"; export PATH'... (2 Replies)
Discussion started by: abdulbadii
2 Replies

3. Web Development

Tapatalk Modification for vB3 - Adding User for System Information

Referring back to this thread: Tapatalk Modification for vB3 - Issue with Avatar Icons I mentioned that we had some "system bot" code: In this post, I describe that code and how easy it is to create a "system bot" user for Tapatalk (TT): Basically, its quite easy. We add a hook to... (0 Replies)
Discussion started by: Neo
0 Replies

4. Shell Programming and Scripting

help in modification of code

I have below code, i want to run this code, but this below code should run on myblocka myblockb myblockcc myblockxx myblockanything but it will not run on "myblock" for BLOCK in /sys/block/myblock* do echo "100000" > "$BLOCK"/abcd done (7 Replies)
Discussion started by: learnbash
7 Replies

5. Shell Programming and Scripting

Awk modification

I need help modifying the code below. DATAFILE is a log file. I have two strings i need to search for in the log file. The two strings are: 1. ERROR 2. com.rolander.promotions.client awk 'BEGIN { while((getline < "'${SFILE}'")>0) S FS="\n"; RS="\n" } (11 Replies)
Discussion started by: SkySmart
11 Replies

6. UNIX for Dummies Questions & Answers

Last modification date without 'ls'

Hi, I'm executing a script to check if a file has been modified on a shared folder. I use this to start another script every time the file has been modified. To do this I use the 'ls' command to get the last modification date of the file. My problem is that the computer hosting the shared... (5 Replies)
Discussion started by: Peuj
5 Replies

7. Shell Programming and Scripting

Restrict modification of a file while it is already in use by another user?

How to restrict modification of a file while it is already in use by another user? If a file is in use by one user account, how to restrict it so that no one else can change it until its closed by the first user? (3 Replies)
Discussion started by: bdiwakarteja
3 Replies

8. UNIX for Advanced & Expert Users

Modification in configuration file to disable a particular user

Please anyone can tell me what is the procedure to perform the required modifications in configuration files to disable a particular user??? (3 Replies)
Discussion started by: debjyotidas007
3 Replies

9. UNIX for Advanced & Expert Users

URGENT: Password modification for oracle user

Hi to all, Need help! For user sysoper on oracle, I want to know who and on which date/time the password has been modified? The platform is unix itself. Thanks (2 Replies)
Discussion started by: ashvik
2 Replies

10. UNIX for Dummies Questions & Answers

How to find out who did the modification

Hi guys, In the UNIX work environment we have access other peoples directory and sometimes we have full access to other people's files. How can we find out , other than modification time that WHO did modification on any file ? I know we can change the access of any file by chmod but... (0 Replies)
Discussion started by: nick27
0 Replies
Login or Register to Ask a Question