cancel
Showing results for 
Search instead for 
Did you mean: 

creating users using VIPW.

SOLVED
Go to solution
senthil_kumar_1
Super Advisor

creating users using VIPW.

Hi

how to create / handle the users using vipw.

11 REPLIES
Suraj K Sankari
Honored Contributor

Re: creating users using VIPW.

hi,

vipw edits the password file while setting the appropriate locks, and does any necessary processing after
the password file is unlocked. If the password file is already being edited, you will be told to try again later.
The vi editor is used unless the environment variable EDITOR indicates an alternate editor. vipw
performs a number of consistency checks on the password entry for root, and does not allow a password
file with an incorrectly formatted root entry to be installed.

Suraj
senthil_kumar_1
Super Advisor

Re: creating users using VIPW.

is vipw is a editor like vim in linux?

can we use vipw to edit any file?

pls explain me how to use vipw to addusers in /etc/passwd.
Ganesan R
Honored Contributor
Solution

Re: creating users using VIPW.

Hi Senthilkumar,

VIPW is noting but edit the /etc/passwd file using vi.
The advantage of using vipw is that only one person can edit at one time. So that it will avoid file corruption.

Using vipw you can directly edit uid/gid/comment/shell/login directory instead of using usermod.

You can also create a new user by putting new entry in /etc/passwd. But note that you need to change the password using passwd command. Also you need to manually copy the startup files from skelton directory.
Best wishes,

Ganesh.
Ganesan R
Honored Contributor

Re: creating users using VIPW.

>>can we use vipw to edit any file?<<

No. You can't edit any other file.

>>pls explain me how to use vipw to addusers in /etc/passwd.<<

Just add another line like any other user in /etc/passwd.

See man vipw for more details.

Best wishes,

Ganesh.
senthil_kumar_1
Super Advisor

Re: creating users using VIPW.

can we use vi to edit /etc/passwd?

but if we use vipw to edit /etc/passwd then no one can edit that file "/etc/passwed" at same time.
Dennis Handly
Acclaimed Contributor

Re: creating users using VIPW.

>can we use vi to edit /etc/passwd?

Why? vipw does that for you.

>but if we use vipw to edit /etc/passwd then no one can edit that file "/etc/passwed" at same time.

That's correct, only one use can be modifying /etc/password at a time.
Dennis Handly
Acclaimed Contributor

Re: creating users using VIPW.

That's:
That's correct, only one user can be modifying /etc/passwd at a time. Other users can still read it.
Ashish Parashar
Frequent Advisor

Re: creating users using VIPW.

Hello Senthil

vipw inshore that the modification is doing by only one user â ¦

Well you can copy one of the string from your password file and edit according to your user ,then edit the password file with vipwâ ¦

If your system is trusted the execute pwconv to update tcb file as well


Thanks & Regards

Ashish Parashar
System Administrator
Suraj K Sankari
Honored Contributor

Re: creating users using VIPW.

Hi Senthil,

Yes you can used vi to edit the /etc/passwd file but in my concerned it better to use vipw instead of vi.

To create new account using vi

If you are using vi to create a account then you need to do this steps
1.create a home directory for user i.e. newuser
2.copy all file from /etc/skel into /home/newuser
3. open /etc/passwd file into vi
4.copy paste last line
5.edit username:uid:gid:comments:homedirectory:shell
6.save the file check with pwck command
7.change the passwd for newuser
8.passwd newuser

HP Guru's please correct me if I miss any step's

Suraj
Mark S Meadows
Valued Contributor

Re: creating users using VIPW.

Suraj :

You will need to edit the /etc/group file as well and cater for the new user in whatever group you wish them to belong to.

Why edit the password file manually when there is a perfectly good HP-UX command "useradd" that will do it for you ?

Mark
Administrating HP-UX systems for more years than I care to admit, but still enjoying it (most of the time!).
Duncan Edmonstone
Honored Contributor

Re: creating users using VIPW.

hmmm... many comments on the mechanics of *how* to do something without bany advice on whether it makes sense to do that!

Just cos a task *can* be done in a certain way, doesn't mean it makes sense to do that. I'm pretty sure I could make money by threatening folks in the street with a knife, but I think I'll stick to having a job for that (ok weak metaphor, but hopefully you get my point).

Whilst vipw is a fine and dandy tool for *editing* the password file for quick fixes such as changing a users shell or home directory, I really wouldn't reccomend it for adding new users - its too open to user error. Stick to using the useradd command. Not only will it check more of what you pass to it, but you can accomplish what you want in fewer steps. It can be as simple as:

useradd senthil
passwd senthil

Of course that gets all the defaults, but they can all be changed on the useradd command line if you wish. Look at the man page for more details.

HTH

Duncan

HTH

Duncan