This is an important question to me.  I have been using UNIX in some flavour
and on various systems since about 1984 and am more than able to throw my
oversized ego over the wall in the hopes of education and instruction.

I have recently run into a situation where I am unclear on what to do.  I
can draw from years of experience but the UNIX way of doing things is to
look to a "standard" somewhere and then apply the rules.  I do this because
I have trust that people far more intelligent and with greater wisdom than
I were responsible for those "standards".  I do recall that I was recently
advised to "violently ignore" a Linux standard doc.  Probably because it had
no regard for the UNIX standard.  Thus I try to stay in the world of UNIX
when I am working with UNIX.

Now then, the point is this :

    Do we need vipw to safely edit the /etc/passwd file ?

    I have been told this is the case and the man page for vipw claims that
it performs some special actions :

$ uname -a
SunOS mars 5.11 snv_35 sun4u sparc SUNW,Ultra-2
$ man vipw
Reformatting page.  Please Wait... done

SunOS/BSD Compatibility Package Commands                 vipw(1B)

NAME
     vipw - edit the password file


SYNOPSIS
     /usr/ucb/vipw

DESCRIPTION
     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, then you will be told to try again later.  The vi(1)
     editor will be used unless the environment  variable  VISUAL
     or EDITOR indicates an alternate editor.

     vipw performs a number of consistency checks on the password
     entry  for  root,  and will not allow a password file with a
     "mangled" root entry to be installed.  It  also  checks  the
     /etc/shells file to verify the login shell for root.

The very end of the manpage also says this :

SEE ALSO
     passwd(1), vi(1), passwd(4), attributes(5)

SunOS 5.10          Last change: 14 Sep 1992                    1

That would be 1992 right ?  The year that I totally stopped using the Apollo
systems and pretty much gave up years with DEC VMS and moved over to early
Solaris.  As in 14 years ago.

Well, perhaps this manpage has not be touched in 14 years because "if its
not broke then don't fix it".  I then look for this thing :

    $ which vipw
    no vipw in /usr/xpg4/bin /sbin /bin /usr/sbin /usr/bin /usr/dt/bin
    /usr/openwin/bin /usr/ccs/bin

Note that my PATH has /usr/xpg4/bin first.  My shell is :

    $ echo $SHELL
    /usr/xpg4/bin/sh

Yes, I am somewhat old fashioned and I still think that vi is pretty cool
and that emacs is a lifestyle choice.  :-)

This system is a Solaris Neveda build 35 system complete with a 800G ZFS
pool and I can not find this vipw in my PATH.  I look around and find it
here :

$ ls /usr/ucb/vipw
/usr/ucb/vipw
$ grep /usr/ucb/vipw /var/sadm/install/contents
/usr/ucb/vipw f none 0555 root bin 13172 23545 1141458063 SUNWscpu
$ pkginfo -l SUNWscpu
   PKGINST:  SUNWscpu
      NAME:  Source Compatibility, (Usr)
  CATEGORY:  system
      ARCH:  sparc
   VERSION:  11.11,REV=2006.03.03.13.51
   BASEDIR:  /
    VENDOR:  Sun Microsystems, Inc.
      DESC:  utilities for user interface and source build compatibility
with SunOS 4.x
    PSTAMP:  juarez20060303140516
  INSTDATE:  Mar 26 2006 22:31
   HOTLINE:  Please contact your local service provider
    STATUS:  completely installed
     FILES:      144 installed pathnames
                   8 shared pathnames
                   1 linked files
                  11 directories
                  64 executables
                2763 blocks used (approx)

That does say "source build compatibility with SunOS 4.x" there right?

The source to this old guy is in usr/src/ucbcmd/vipw/vipw.c and it boldly
says :

/*
 * Portions of this source code were derived from Berkeley 4.3 BSD
 * under license from the Regents of the University of California.
 */

See the whole thing at :

  http://polaris.blastwave.org/browser/on/trunk/usr/src/ucbcmd/vipw/vipw.c

Now I have seen a lot of tools come and go.  There was admintool once upon a
time and it is nowhere to be found in the sources.  This vipw thing seems to
be the UNIX standard way to edit the /etc/passwd file but it may have been
invented before the /etc/shadow file was a glimmer of a thought.  Certainly
in the days of yellow pages and NIS and well before LDAP.

So I can not see a reason why a person needs vipw to edit the /etc/passwd
file and good old vi ( mine is /usr/xpg4/bin/vi ) will do the job nicely and
safely.  The correct way may be simply to use usermod(1M) and not ever edit
/etc/passwd directly.

I recently adopted a "style" of doing things that may be "Linux like" and
thus a bad thing in the strict UNIX world.  I began to put my root user in a
home directory of /root along with all of the dot files that get created for
the root user.  Like the .sunw directory which seems to appear out of
nowhere.  Certainly .profile and ( *gasp* ) .bash_history !  I really do not
want to see these things all over my / area.  I was recently told this is a
very "bad thing" and that it harms the way vipw works.  I never heard of
vipw, certainly not since Madonna was still making hit records, on vinyl.

        Or am I mistaken here ?   Old fashioned and confused ?

Thus I sit with coffee in hand and hope for some illumination please.  If
not for my sake then to perhaps put some old ways of doing things to rest.

-- 
Dennis Clarke

_______________________________________________
opensolaris-discuss mailing list
opensolaris-discuss@opensolaris.org

Reply via email to