Sunday, January 13, 2019

How to change existing user ID on Suse Linux using usermod command

Hello Friend ,

Today i am going to share how Linux admin can change existing user id. while doing day-today user administration task we got ticket for change existing user ID.

Request Details:

Change oracle user ID from 3600 to 3800.

Prerequisite check before changing user ID .

1. Make sure that new user ID which we going to use is not in use by any other user.
here 3800 is the new user id, so we can check whether its in use or not by using following command.

#cat /etc/passwd |grep -i 3800

2. No process with user id 3600 ,should be running while changing userid.
If any process is in running state(using user id 3200) while changing user id it will throw following error .

usermod: user oracle is currently used by process 17340


Now after checking all prerequisite we executed below command for userid change.

Syntax :  usermod -u [new_user_id]  [user_name]

root@Linux:/root : usermod -u 3800 oracle

-u new user ID for oracle user.

After executing above command we got some error message like below

"usermod: user oracle is currently used by process 17340"

After checking process details we found that its oracle process running with user id oracle[3600], So we checked with DBA team should we kill that process??. After there confirmation we killed process using command "#kill -9 17340" and re-run usermod command again and this time it executed successfully.

*** in production environment double check impact of killing any existing process. It will have impact on currently running application/database.

Check modified uid using below command.

#cat /etc/passwd |grep -i  oracle.

Thanks !!!





No comments:

Post a Comment