Subject: Re: Adduser
To: port-mac68k mailing list <port-mac68k@netbsd.org>
From: Steve Revilak <revilak@umbsky.cc.umb.edu>
List: port-mac68k
Date: 09/05/1998 01:41:12
"Ulrich Hausmann" <ulrich.hausmann@rhein-neckar.netsurf.de> wrote:
>
>I'm still trying to find out, how to configure a new user. In this context
>a
>very practical question:
>
>There are 2 passwd manual pages (passwd(1) and passwd(5)). When I call 'man
>passwd' it always points only to the first one. 'man passwd(1)/(5)' does
>not
>work. What am I doing wrong?
>
>Thanks in advance, Ulrich

	man 5 passwd

	to get to the chapter 5 entry.  man man for more details on man.


As far as a new user account -- when I first began using NetBSD, late this
past winter, I wrestled with the same critter as a unix newbie.  (These
days, I'm still a newbie...just less of a newbie than I was six or seven
months ago).

This is a copy of a posting that I made during that general period in time.
Giving it a quick look over, it seems reasonably accurate.  Sorry for the
excessive length.  It's something I saved--inevitably this question gets
asked from time to time.  [Bracked stuff is new as of this posting]

Gripes or no-no's that I missed during my re-read?  Please let me know ans
I'll make revisions.

Steve
revilak@umbsky.cc.umb.edu

----------Reposting Follows-----------

>I have tried to no avail to set up my user account.
>
>I can't find anything in the NetBSD faq's on setting up a user account.  My
>Sobell Unix book isn't helpful at all--I follow the instructions, use vipw,
>and keep getting a line corrupted error, and vi won't let me save the file.
>
>Can someone point me to a page (a page that is actually UP, not the *dead*
>links mentioned in the faq) that has these instructions?  Or, could someone
>just write these instructions down and email them to me, or better yet,
>post
>them somewhere?

I'm still new enough of a newbie to have wrestled through this fairly
recently...

Preliminary places to start-- man pages for adduser (general info for
adding a new user) and passwd (for the formatting of data in
/etc/master.passwd).  To begin, I logged in as root in multi-user mode....

I remeber encountering the vipw error you mention. I believe I got around
that by logging in as root, and using the command 'chfn' to change roots
finger information (root is line 1 of the master.passwd file).  Then,
'pwd_mkdb /etc/master.passwd' to rebuild the password database files.

Okay, so you're logged in as root.  You'll need to edit /etc/master.passwd.
Use 'vipw' or just edit the file directly ('pwd_mkdb /etc/master.passwd'
once you've finished if you went the edit-the-file-directly.)

There are a bunch of fields, seperated by colons.  Below is an example:

root:*:0:0::0:0:Charlie &,,,:/root:/bin/csh

1) Username--this must be unique

2) Encrypted passwd (probably an '*' for most entries).  Leave this blank
for now (no white space).

3) User ID # - this must be a unique number

4) Group #.  You'll probably find that making yourself a 'wheel' member is
most useful.  The number for wheel is 0.

5) Class--you can just leave this blank.

6 & 7) I forget exactly what these are, but I believe they're not really
used by the system.  Enter Zeros.

8) Your personal name.  Just fill that in.  Ignore the '&,,,,' for now.

9) Home directory.  You should create a folder for yourself and list that
here.  (After doing so, don't forget to use 'chown' to change the ownership
of the folder--so that you own it)

10) Path of the shell you will use.  I used /bin/csh. [currently /bin/tcsh.
A nice improvement.  I believe tcsh is in with the packages...]

One thing you might find helpful...position your entry in the file so that
the user ID you assign yourself falls in ascending numerical order,
relative to the other User ID#s.  In vi, postion the cursor where you'd
like to insert the line, press ESC to make sure you're in command mode and
then type a capital O.


After you've finished with the password file, edit /etc/groups.  Find the
line that begins with 'wheel'.  After the last entry on the line add a
comma and your username (no white space).  You may also wish to add
yourself to operator as well.  (IIRC, master.passwd only contains your
primary group association.  Leave that as wheel (Group # 0) But it is okay
to list yourself several times in /etc/groups).

Next, a few files to have in your home directory:

.login
.chsrc (or .profile is you're using ksh)
You should find copies of this in either / or /root.  Just copy them into
your directory.  (Don't forget to use 'chown' to change the ownship of
these after copying).

.login--commands that are executed each time you log in.
.cshrc--commands executed each time your shell starts up.

These set user environment, create command line aliases, etc.

(Format for chown is 'chown <userid to change ownership to> <filename>').

Then try to log in as yourself.  Lastly, once you've logged in as yourself,
you may want to use 'chfn' (change finger information) to add your personal
info and 'chpass' to give yourself as password.

Again, this is being rattled off from memory (I'm in MacOS right now).
Please double check what I've said about the formatting of password files
with what's contained in passwd(5).

A fairly inexpensive book that helped me out tons (please don't laugh) was
"Teach Yourself Unix in 24 hours", published by SAMS.  It breaks the basics
down into a bunch of 1 hour lessons--it's very approachable, and I'd
reccomend it hightly to the beginner.  On the back cover, it says it has a
website http://www.intuitive.com/tyu24.  Haven't looked at that,
though....just bought the book.  [It's not to bad from the 'user end'.  A
really good book on admin?
"The Unix Systems Administrators Guide" by Nemeth, Snyder, Seebass, et al.
Not cheap, but extremely useful, IMHO]

Other relevant man pages-- csh, and a few that come up when you type
'apropos group'.

Good luck.