Operating System - HP-UX
1753882 Members
7677 Online
108809 Solutions
New Discussion юеВ

Re: add user: change loginname, keep UID HP-UX 11.00

 
SOLVED
Go to solution

add user: change loginname, keep UID HP-UX 11.00

Hallo guys,
a female user has married and wants to get a new login-name.
1. How to create a new user with the same UID and
2. remove the old user without losing some files or
3. does a command exist (11.00,) how to change username (without creating and deleting new user).
If possible, without sam.

Thank you,
Michael

(sorry to have put the same question in a wrong forum first)
5 REPLIES 5
Pete Randall
Outstanding Contributor
Solution

Re: add user: change loginname, keep UID HP-UX 11.00

Michael,

I think all you need to do is edit the /etc/passwd file (use vipw to be safe), duplicate the existing line, change the name (and possibly the home directory name). Then get rid of the original line and use "chown -R newuser /home/username" (first renaming the /home/username if you chose to rename it in /etc/passwd).


Pete

Pete
RAC_1
Honored Contributor

Re: add user: change loginname, keep UID HP-UX 11.00

Option 1
Create new user with same uid.
vipw and add user.

Delete the old user and change the ownership of files owned by old user to new user.

Option 2

vipw, rename the user.

Change the file ownership.

Anil
There is no substitute to HARDWORK
Jeff_Traigle
Honored Contributor

Re: add user: change loginname, keep UID HP-UX 11.00

Much quicker than hacking files manually:

usermod -d newhomepath -m -c "newname" -l newlogin login

Automatically does the passwd entry, creates the new home directory, and copies the files from the old to the new home directory. Leaves the old home directory in place with all files, however, so that would need to be removed manually.
--
Jeff Traigle
lawrenzo
Trusted Contributor

Re: add user: change loginname, keep UID HP-UX 11.00

I think you can use:

# su - root
# usermod -l [new name] loginname

see man pages usermod - this does not update the home directory name.
hello

Re: add user: change loginname, keep UID HP-UX 11.00

Hello,
thank you for all your answers.

Pete: best answer
RAC: Option 1: ok, but files get new dates
Option 2: ok
Jeff: easy and fast, but files get new date (because of copying)
lawrenzo: good solution; you have to edit passwd and change homedirectory afterwards

Points to you all,
Michael