Administration of User and Group Files

I seldom have to deal with user / group creation and modification. I tend to use primitive ways like vipw, vi /etc group or just use man to find a command and apply. The same with openbsd and with linux.

There is an inflation of commands, some old BSD, other SYSV, others typical to these three OS. I am thinking to make a list of commands that are similar on FreeBSD, OpenBSD and Linux for trying to stick on them.

What do you use and why?
 
As you do: edit the files in /etc/ by hand (through vipw if necessary).

My passwd and group files are commented and well structured; automated editing tools would lose that.
 
Old site, still useful, but might need an update: https://bhami.com/rosetta.html
There you see clearly the inflation I spoke about. Command with same name, but different functionality across systems, many commands for the same functionality in the same system, etc.

That is wise, because pw mimics the SYSV commands that are more standard than others, but unfortunately does not mimic 100% and the man page is difficult to read. Not caring in small details, flags, can be fatal.

It wonders me that OpenBSD has no vigr or a program to check /etc/group, but FreeBSD and Linux.
 
It wonders me that OpenBSD has no vigr or a program to check /etc/group, but FreeBSD and Linux.
The vigr program is a relatively recent addition to FreeBSD,according to the man page it showed up in 11.0. Neither OpenBSD nor MacOS have it (I think MacOS' user land is from roughly FreeBSD 5, with later updates). I suspect it was copied from Linux.

It is not that necessary; the only thing it does that an editor doesn't is to check the syntax after editing. Which is nice, but the real problem tends to be the semantics and typos (group 987 is not the same as group 789).
 
the only thing it does that an editor doesn't is to check the syntax after editing.
For example that name and gid are different on different records?
Semantic errors can give permissions to someone should not have them.
Perhaps /etc/group is not so critical as /etc/passwd, but it deserves to be checked carefully.
 
vipw(8) and vigr(8) does the job of syntax checking so that the human does not introduce a typo in the files.

The other way of solving it which is implemented in Solaris 11 is to not encourage the sysadmin to edit the files but to use :

useradd (1M) https://docs.oracle.com/cd/E26502_01/html/E29031/useradd-1m.html

usermod(1M) https://docs.oracle.com/cd/E26502_01/html/E29031/usermod-1m.html

groupadd(1M) https://docs.oracle.com/cd/E26502_01/html/E29031/groupadd-1m.html

groupmod(1M) https://docs.oracle.com/cd/E26502_01/html/E29031/groupmod-1m.html

which are not interactive but option driven.
 
Usually adduser on a new system with only username and password given but sometimes I feel like pw. It's actually quite convenient if you want to change specific user properties.. The syntax description already explains everything.
 
which are not interactive but option driven.
That are System V commands, not BSD commands. pw is meant to mimic them, but it does not do it 100%.

The old BSD style seems to be to edit the files and use for example commands like:

vipw
pwd_mkdb
chpass (chfn, chsh)
passwd
vi /etc/group

See 4.3BSD NET/2 man page for adduser (no command):


System V seems to be the one that began to create these systematic commands with flags to avoid direct editing,
and feel inflated. Linux and Solaris feel inflated, it is the simplicity of BSD what I always liked.

OpenBSD has also commands that mimic the System V ones, but again not 100%.

I think, one could keep in mind elementary commands to create user and groups, and when necessary just edit.

Usually adduser on a new system with only username and password given but sometimes I feel like pw. It's actually quite convenient if you want to change specific user properties.. The syntax description already explains everything.
Yes, but vipw is easier to use for changing properties.
 
Back
Top