How can I change my uid without opening another user account?

2

I'm using ubuntu 10.10. I wish to change my user id.

How can I change it without opening another account?

I tried using System->Administration->Users and Groups but I got a message saying the user is logged in (which is true, that's me!).

Also tried using the shell:

dave@mypc:~$ sudo usermod -u 875 dave
[sudo] password for dave: 
usermod: user dave is currently logged in

So what can I do?

David B

Posted 2010-10-14T10:11:04.247

Reputation: 1 974

2

You might get a better/quicker answer over on http://askubuntu.com

– ChrisF – 2010-10-14T10:12:44.150

There is a solution at http://askubuntu.com/questions/16700/how-can-i-change-my-own-user-id

– feeela – 2012-10-09T18:31:59.980

Answers

8

You need to log with a different account in order to change the dave account.

Either log in as another (temprarily created for this purpose) user and use sudo as you tried in your question, or log in as root at a text console (CTRL-ALT-F1 etc).

Before you can log in directly as root, you will have to enable it by setting a password (use the command sudo passwd root. To re-disable the root login afterwards log in as yourself and use the command sudo usermod -p '!' root).

Neal

Posted 2010-10-14T10:11:04.247

Reputation: 8 447

1

Log out, switch to a text console, log in as root, and then run usermod to change the UID, and then run find to find all files owned by the old UID and change them.

Ignacio Vazquez-Abrams

Posted 2010-10-14T10:11:04.247

Reputation: 100 516