Creating a User with niload
The niload
utility understands the flat file format used by
/etc/passwd
(name:password:uid:gid:class:change:expire:gecos:home_dir:shell).
See the passwd(5) manpage for a description of
each field. To add a new user, create a file that adheres to that
format and load it with niload. You can use a
here document rather than a separate file. This example creates a
user for Ernest Rothman with a UID of 701 and membership in the
staff (GID 20) group:
# niload passwd . <<EOF ? rothman:*:701:20::0:0:Ernest Rothman:/Users/rothman:/bin/tcsh ? EOF
As you can see from this example, we set the password field to
*, which disables logins for that account. To set
the password, we’ll use the passwd
command to set it:
# passwd rothman Changing password for rothman. New password: ******** Retype new password: ********
If you niload a user that already exists, that user will not be overwritten or changed in any way. You should delete the user with nicl first (see Section 3.7.5, earlier in this chapter). Before the user can log in, you must create his home directory (see Section 3.8.3, later in this chapter).