HP-UX - General

How do I change a user (login) name?

 
SOLVED
Go to solution
Gary Cooper_1
Esteemed Contributor

How do I change a user (login) name?

(HP-UX 10.20)
Machine A has user 'fred' with uid 101.
Account 'fred' is not used; /home/fred only contains environment files (.profile etc.).
Machine B has user 'bill' with uid 101. Machine B has an NFS mount onto machine A and 'bill' has written lots of files onto machine A. As you would expect the files look as though they are owned by 'fred' on machine A.
(Incidentally, 'bill' is an application admin account and not a real user account).

What I want to do (I think) is either rename account 'fred' on machine A to 'bill' (Can this just be as simple as editing passwd & group and moving /home/fred to /home/bill?), OR delete account 'fred' on machine A and create account bill with UID 101. (So that all of the (101) files on machine A end up being owned by 'bill'.

I'm 99.9% sure that the application won't object to the name change (famous last words!).

Does anyone see any problems with either of these approaches?

Thanks

Gary Cooper
4 REPLIES 4
T G Manikandan
Honored Contributor
Solution

Re: How do I change a user (login) name?

Yes,you can go ahead in modifying the username i.e.from fred to Bill,
provided that you do not require the user 'fred'.

You can user SAM for that,which should be the simpler way.

else you can use
usermod -u 101 -l
Thanks
Victor BERRIDGE
Honored Contributor

Re: How do I change a user (login) name?

Hi,
And also dont forget to check if your box is trusted, that bill exists in /tcb/files/auth/b, if not - move /tcb/files/auth/f/fred to /tcb/files/auth/b/bill

Good luck
Victor
Gary Cooper_1
Esteemed Contributor

Re: How do I change a user (login) name?

Thanks guys.
I used sam & it mostly worked OK (it left the files in the original users home directory and didn't create a new user directory (which I had to do by hand), but it seems OK now.

Regards,

Gary
Peter Kloetgen
Esteemed Contributor

Re: How do I change a user (login) name?

Hi Garry,

if you use SAM, another trick would do it for you:

first you delete user fred with SAM, use the option: --> leave all data where they are

then you find a option to give the whole home directory to a new username. ( If you delete a user, but not his data, the UID of the deleted user is shown as owner of data. If you create a user with *this* UID, he will automatically own the data)

Allways stay on the bright side of life!

Peter
I'm learning here as well as helping