About user login change

For some reasons, we often change user logins.
At machine 1, for example, we change login name from A to B.
Usually we'd like to type "vipw" and replace A with B at the editor screen, then quit editor with "wq".
I know that "pw usermod A -l B" cold also get the same result.

Is there any difference between these two methods?
It says that "vipw" will lock the user database until finish.
How about "pw" ?
 
goldenfire said:
Is there any difference between these two methods?
vipw uses an editor, pw doesn't.

It says that "vipw" will lock the user database until finish.
How about "pw" ?
They both lock the database. But pw is almost instantly done whereas vipw is done once vi is closed.
 
SirDice said:
vipw uses an editor, pw doesn't.


They both lock the database. But pw is almost instantly done whereas vipw is done once vi is closed.

Thank you very much.
So "pw" is also a safe method to change user login (or modify user database) ?
Posing this question is because that I could not find a good way to use vipw in shell script.
 
You could say that vipw is for a simple manual change, whereas pw lends itself more to scripting because everything can be passed on the command-line.
 
SirDice said:
But pw is almost instantly done whereas vipw is done once vi is closed.

Better: ... once $EDITOR is closed.
 
Back
Top