Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ adduser(8) — SunOS 2.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

passwd(1)

mkdir(1)

chown(8)

chsh(1)

passwd(5)

vipw(8)

ADDUSER(8)  —  MAINTENANCE COMMANDS

NAME

adduser − procedure for adding new users

DESCRIPTION

To add a new user account to the system, you must do at least the following things:

1.Create an entry in the system password file for that user. 

2.Make a ‘home directory’ for the user and make sure that the user is the owner of their home directory. 

3.Set up some skeletal profile files for the new user. 

These steps are described in detail below. 

Making an entry in the password file: A new user must choose a login name, which must not already appear in /etc/passwd.  An account can be added by editing a line into the /etc/passwd file; this must be done with the password file locked, for example, by using vipw(8).

A new user is given a group and user id.  User id’s should be distinct across a system, since they are used to control access to files.  Typically, users working on similar projects will be put in the same group.  System staff is group ‘10’ for historical reasons, and the super-user is in this group. 

A skeletal account for a new user ‘francine’ would look like:

francine::235:20:& Featherstonehaugh:/usr/francine:/bin/csh

Fields in the password file have the following meanings:

1.Login name (‘francine’).  The login name is limited to eight characters in length. 

2.Encrypted password.  Typically, this field is left empty for a new user so that the first time they log in they don’t need a password.  They can then set their password to whatever they like using the passwd(1) command.

3.User ID.  The user ID is a number which identifies that user uniquely in the system.  All files that that user creates have this number stored in the data block that describes the file and commands such as ls(1) use that number to look in the password file to get the user’s name when identifying the owner of the file.  For this reason, you cannot just go merrily changing this number at random.

4.Group ID.  The group ID is a number which identifies the group to which the user belongs.  All files that that user creates have this number stored in the data block that describes the file and commands such as ls(1) use that number to look in the groups file to get the groups name when identifying the group ownership of the file.

5.This field is called the ‘GCOS’ field (from earlier implementation of the UNIX system) and is traditionally used to hold the user’s full name.  Some installations have other information encoded in this field.  From this information we can tell that Francine’s real name is ‘Francine Featherstonehaugh’.  The & here is a shorthand for the user’s login name. 

6.User’s home directory.  This is the directory in which that user is ‘positioned’ when they log in. 

7.Initial shell which this user will see on login.  If this field is empty, sh(1) is used as the initial shell.

Making a home directory for the new user: now you make a home directory for Francine.  As shown in the password file entry above, Francine’s home directory is /usr/francine. Francine must be the owner of that directory in order to create files there.  So the following sequence would suffice:

tutorial# mkdir /usr/francine
tutorial# /etc/chown francine /usr/francine
tutorial#

Setting up skeletal profile files: It is useful to give new users some help in getting started, supplying them with a few skeletal files such as .profile if they use /bin/sh as the shell, or .cshrc and .login if they use /bin/csh as the shell.  New users should be given copies of these files which, for instance, arrange to use tset(1) automatically at each login.

FILES

/etc/passwdpassword file

SEE ALSO

passwd(1), mkdir(1), chown(8), chsh(1), passwd(5), vipw(8)

Sun Release 2.0  —  Last change: 11 October 1984

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026