0

There is an option to have more than one user on your linux box and use them for different task. So, basically, I used it sometime to have different instance of application for different projects. For that, I normally add another user. The new user will have different uid and it could have different gid or something common between my users.

To make this post more readable, let me define some names that makes more sense. Suppose the main user name is Umain, and the second one is Uclone.

This time, I tried to create the Uclone with the same id as Umain. (I wanted to have everything the same and I didn't consider the consequences) So, I created the Uclone by:

 sudo useradd Uclone -m -N -o -g 1000 -u 1000

The userid and group id of Umain are 1000, and I tried to create the clone of my user with above command to assign the same userid and groupid to Uclone.

Everything was fine, until I restart my system. I can't login to Umain anymore and the Uclone is the one that is available in the login page. The Umain exist in the /etc/passwd, however, I can not login to gdm or kdm with Umain user anymore.

I tried to remove the Uclone but I couldn't. It always replied that there is some process that are running by this user. So, I killed the process and it came back again. I just realized that as the userid are the same, now the system have to problem to recognize the Umain and Uclone. I tried to change the groupid of the Uclone and I was successful. However, I can't change the userid of Umain or Uclone since I get below response.

 $ sudo usermod Uclone -u 1010
 [sudo] password for AnotherUser:
 usermod: user Uclone is currently used by process pid

So, I am wondering what options I have to fix my system. I think the last hope would be using rescue mode, but I think there should be more easier way to handle this. I appreciate if you can help me to resolve this problem.

Side note: I am using Ubuntu 14.04.

0

That's the same user. You can use vipw and vipw -s commands to remove the line that points to the Uclone user. Vipw command use vi as default editor, so you can replace it with some easier, like for example is nano:

sudo EDITOR=nano vipw
0

Actually Umain and Uclone are the same user.

And yes you can't modify the UID of your user since you are login using its credentails and thus you can't chnage ot modify its behavior unless you are not using any other process of your system.

To solve your problem(if you think it's) you have many solutions:

  1. Use a live cd and do whatever you want
  2. Easiest is create another sudoer user suppose tempUser. Logout from Uclone and use the tempUser to login and then edit whatever for other users.
  • I used different user(not guest) and I tried to remove the Uclone. Your solutions are valid, but I was looking for something that I don't need to stop the current process of the system since I have mysql server that some people are connecting to it. As I see Panta suggested to remove the line related to Uclone in /etc/passwd, I changed it's userid to something else, and after reboot I can remove the Uclone with userdel command. – Ehsan Sadr May 6 '15 at 14:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.