1.\" Copyright (c) 1995-1996 Wolfram Schneider <wosch@FreeBSD.org>. Berlin. 2.\" All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. 9.\" 2. Redistributions in binary form must reproduce the above copyright 10.\" notice, this list of conditions and the following disclaimer in the 11.\" documentation and/or other materials provided with the distribution. 12.\" 13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23.\" SUCH DAMAGE. 24.\" 25.\" $Id: adduser.8,v 1.24 1998/02/14 22:55:23 steve Exp $ 26.\" 27.Dd January 9, 1995 28.Dt ADDUSER 8 29.Os FreeBSD 2.1 30.Sh NAME 31.Nm adduser 32.Nd command for adding new users 33.Sh SYNOPSIS 34.Nm adduser 35.Oo 36.Fl batch Ar username 37.Op Ar group Ns , Ns Op Ar group,... 38.Op Ar class 39.Op Ar fullname 40.Op Ar password 41.Oc 42.br 43.Op Fl check_only 44.br 45.Op Fl class Ar login_class 46.br 47.Op Fl config_create 48.br 49.Op Fl dotdir Ar dotdir 50.br 51.Op Fl group Ar login_group 52.br 53.Op Fl h | help 54.br 55.Op Fl home Ar home 56.br 57.Op Fl message Ar message_file 58.br 59.Op Fl noconfig 60.br 61.Op Fl shell Ar shell 62.br 63.Op Fl s | silent | q | quiet 64.br 65.Op Fl uid Ar uid_start 66.br 67.Op Fl v | verbose 68.Sh DESCRIPTION 69.Nm Adduser 70is a simple program for adding new users. Adduser checks 71the passwd, group and shell databases. It creates passwd/group entries, 72.Ev HOME 73directory, dotfiles and sends the new user a welcome message. 74.Sh RESTRICTIONS 75.Bl -tag -width Ds -compact 76.It Sy username 77Login name. May contain only lowercase characters or digits. Maximum length 78is 16 characters (see 79.Xr setlogin 2 80BUGS section). 81The reasons for this limit are "Historical". 82Given that people have traditionally wanted to break this 83limit for aesthetic reasons, it's never been of great importance to break 84such a basic fundamental parameter in UNIX. 85You can change 86.Dv UT_NAMESIZE 87in 88.Pa /usr/include/utmp.h 89and recompile the 90world; people have done this and it works, but you will have problems 91with any precompiled programs, or source that assumes the 8-character 92name limit and NIS. The NIS protocol mandates an 8-character username. 93If you need a longer login name for e-mail addresses, 94you can define an alias in 95.Pa /etc/aliases . 96.It Sy fullname 97Firstname and surname. 98The 99.Ql Pa \: 100character is not allowed. 101.It Sy shell 102Only valid shells from the shell database or sliplogin and pppd 103.It Sy uid 104Automatically generated or your choice, must be less than 32000. 105.It Sy gid/login group 106Your choice or automatically generated. 107.It Sy password 108If not empty, password is encoded with 109.Xr crypt 3 . 110.El 111.Sh UNIQUE GROUPS 112Perhaps you're missing what 113.Em can 114be done with this scheme that falls apart 115with most other schemes. With each user in his/her own group the user can 116safely run with a umask of 002 and have files created in their home directory 117and not worry about others being able to read them. 118.Pp 119For a shared area you create a separate uid/gid (like cvs or ncvs on freefall), 120you place each person that should be able to access this area into that new 121group. 122.Pp 123This model of uid/gid administration allows far greater flexibility than lumping 124users into groups and having to muck with the umask when working in a shared 125area. 126.Pp 127I have been using this model for almost 10 years and found that it works 128for most situations, and has never gotten in the way. (Rod Grimes) 129.Sh CONFIGURATION 130.Bl -enum 131.It 132Read internal variables. 133.It 134Read configuration file (/etc/adduser.conf). 135.It 136Parse command line options. 137.El 138.Sh OPTIONS 139.Bl -tag -width Ds 140.It Sy -batch username [group[,group]...] [class] [fullname] [password] 141Batch mode. 142The listed groups are secondary groups that the new user should be a 143member of in addition to the default login group. Null string arguments 144may be used as place holders and result in the default value for the 145nulled field being used. 146.It Sy -check_only 147Check /etc/passwd, /etc/group, /etc/shells and exit. 148.It Sy -class Ar login_class 149Set default login class. 150.It Sy -config_create 151Create new configuration and message file and exit. 152.It Sy -dotdir Ar directory 153Copy files from 154.Ar directory 155into the 156.Ev HOME 157directory of new users, 158.Ql Pa dot.foo 159will be renamed to 160.Ql Pa .foo . 161Don't copy files if 162.Ar directory 163specified is equal to 164.Ar no . 165For security make all files writable and readable for owner, 166don't allow group or world to write files and allow only owner 167to read/execute/write 168.Pa .rhost , 169.Pa .Xauthority , 170.Pa .kermrc , 171.Pa .netrc , 172.Pa Mail , 173.Pa prv , 174.Pa iscreen , 175.Pa term . 176.It Sy -group Ar login_group 177Login group. 178.Ar USER 179means that the username is to be used as login group. 180.It Sy -help,-h,-? 181Print a summary of options and exit. 182.It Sy -home Ar partition 183Default home partition where all users located. 184.It Sy -message Ar file 185Send new users a welcome message from 186.Ar file . 187Specifying a value of 188.Ar no 189for 190.Ar file 191causes no message to be sent to new users. 192.It Sy -noconfig 193Do not read the default configuration file. 194.It Sy -shell Ar shell 195Default shell for new users. 196.It Sy -silent,-s,-quiet,-q 197Few warnings, questions, bug reports. 198.It Sy -uid Ar uid 199Use uid's from 200.Ar uid 201on up. 202.It Sy -verbose,-v 203Many warnings, questions. Recommended for novice users. 204.Sh FORMATS 205.Bl -tag -width Ds -compact 206.Ql Pa # 207is a comment. 208.It Sy configuration file 209.Nm Adduser 210reads and writes this file. 211See 212.Pa /etc/adduser.conf 213for more details. 214.It Sy message file 215Eval variables in this file. See 216.Pa /etc/adduser.message 217for more 218details. 219.El 220.Sh EXAMPLES 221.Pp 222$ adduser 223.Pp 224Start adduser in interactive mode. 225.Pp 226$ adduser -batch baerenklau guest,staff,baer '' 'Teddy II' qwerty7 227.Pp 228Create user 'baerenklau' and login group 'baerenklau'. Invite user 229baerenklau into groups guest, staff and baer. Use default login class. 230Realname (fullname) 231is 'Teddy II'. Password is 'qwerty7' (don't use such passwords!). Create 232.Ev HOME 233directory 234.Pa /home/baerenklau 235and copy all files and directories 236from 237.Pa /usr/share/skel 238to 239.Pa /home/baerenklau . 240Send user baerenklau 241a welcome message. 242.Pp 243$ adduser -uid 5000 -group guest -message no -batch vehlefanz 244.Pp 245Create user 'vehlefanz'. Login group is guest. Uid next available uid 246after 5000, for instance 5007. No other groups, no realname, no password. 247Do not send a welcome message. 248.Sh FILES 249.Bl -tag -width /etc/master.passwdxx -compact 250.It Pa /etc/master.passwd 251user database 252.It Pa /etc/group 253group database 254.It Pa /etc/shells 255shell database 256.It Pa /etc/login.conf 257login classes database 258.It Pa /etc/adduser.conf 259configuration file for adduser 260.It Pa /etc/adduser.message 261message file for adduser 262.It Pa /usr/share/skel 263skeletal login directory 264.It Pa /var/log/adduser 265logfile for adduser 266.El 267.Sh SEE ALSO 268.Xr chpass 1 , 269.Xr finger 1 , 270.Xr passwd 1 , 271.Xr setlogin 2 , 272.Xr yp 4 , 273.Xr aliases 5 , 274.Xr group 5 , 275.Xr login.conf 5 , 276.Xr passwd 5 , 277.Xr shells 5 , 278.Xr addgroup 8 , 279.Xr pwd_mkdb 8 , 280.Xr rmgroup 8 , 281.Xr rmuser 8 , 282.Xr vipw 8 283.\" .Sh BUGS 284.Sh HISTORY 285The 286.Nm 287command appeared in 288.Fx 2.1 . 289