Change UID

2007-12-25 9:07:00

Thanks for all answers!!

Feng

--------------------

from: larry d. clark" <buddy@dfw.net>

If you are root, change /etc/passwd, then cd into the directory

where the $HOME is and issue chown -R user_name $HOME.

--------------------

from: sozoa@atmel.com (Steve Ozoa)

You'll also have to fix the ownership of all their files

---------------------

from: mike@trdlnk.com (Michael Sullivan)

Besides /etc/passwd, you will need to change /etc/shadow, and you will

need to change ownership of all the user's directories and files, not

just those under his home directory, but any others that may be

scattered around the file systems, such as /var/mail/user.

--------------------

from: "K.Ravi" <RAVKRISH.IN.ORACLE.COM.ofcmail@in.oracle.com>

Yes, you have to modify /etc/passwd. Edit it manually or use 'usermod'.

But be

sure to do a 'chown' for all files owned by the user. (cd to user's home

directory, run 'chown -R <newuid> *' . If the user's files are spread in

different places, you might have to do something like this:

# find / -user <olduid> -print |xargs chown <newuid> )

-------------------

from: Cagri Yucel <cyucel@is.ku.edu.tr>

Change password file. But the files owned by this user will remain

having

the old UID. This probably will be displayed as a number, make a

chown -R new_uid users_home to solve this problem.

--------------------

from: si jianwei <sjw@bjaimail.asiainfo.com>

You can do this job if you have root account.

Please try it .

First you should change to root user. Next, use "usermod" command. For

Example,

% su -

# usermod -u 9999 usera

# cd ~/usera; cd ..

# chown -R usera usera

Of course, you can edit /etc/passwd file to change user's id.

But , be warned the user's home directory must be changed with "chown"

command.

--------------------

from: Tom Powers <tomp@cwix.net>

On the off hand chance you haven't already gotten a hundred replies

to this, here's my suggestion.

Use the command:

        usermod -u NEWUID LOGIN

then run a find to change the ownership

        find / -user OLDUID -print -exec chown NEWUID {} \;

I'm in the process of syncronising a few dozen machines, all of which

have the same users but different UID numbering schemes, so I'm using

this a lot

HTH

---------------------

original message:

>

> Hello, Happy New Year!!

> If I want change a User's UID, what should I change, passwd file,

> anything else? SPARCStation 5 with solaris2.5.1.

> Thanks!!

>

Comments

Got something to say?

You must be logged in to post a comment.