Initial commit for Tizen
[profile/extras/shadow-utils.git] / man / sv / useradd.8
1 '\" t
2 .\"     Title: useradd
3 .\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
4 .\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
5 .\"      Date: 16-02-2011
6 .\"    Manual: Systemhanteringskommandon
7 .\"    Source: Systemhanteringskommandon
8 .\"  Language: Swedish
9 .\"
10 .TH "USERADD" "8" "16-02-2011" "Systemhanteringskommandon" "Systemhanteringskommandon"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 .ie \n(.g .ds Aq \(aq
19 .el       .ds Aq '
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
24 .nh
25 .\" disable justification (adjust text to left margin only)
26 .ad l
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
30 .SH "NAMN"
31 useradd \- skapa en ny anv\(:andare eller uppdatera standardinformation f\(:or nya anv\(:andare
32 .SH "SYNOPSIS"
33 .HP \w'\fBuseradd\fR\ 'u
34 \fBuseradd\fR [\fIflaggor\fR] \fIINLOGGNINGSNAMN\fR
35 .HP \w'\fBuseradd\fR\ 'u
36 \fBuseradd\fR \-D
37 .HP \w'\fBuseradd\fR\ 'u
38 \fBuseradd\fR \-D [\fIflaggor\fR]
39 .SH "BESKRIVNING"
40 .PP
41 When invoked without the
42 \fB\-D\fR
43 option, the
44 \fBuseradd\fR
45 command creates a new user account using the values specified on the command line plus the default values from the system\&. Depending on command line options, the
46 \fBuseradd\fR
47 command will update system files and may also create the new user\*(Aqs home directory and copy initial files\&.
48 .PP
49 By default, a group will also be created for the new user (see
50 \fB\-g\fR,
51 \fB\-N\fR,
52 \fB\-U\fR, and
53 \fBUSERGROUPS_ENAB\fR)\&.
54 .SH "FLAGGOR"
55 .PP
56 Flaggorna som g\(:aller f\(:or kommandot
57 \fBuseradd\fR
58 \(:ar:
59 .PP
60 \fB\-b\fR, \fB\-\-base\-dir\fR \fIBASE_DIR\fR
61 .RS 4
62 The default base directory for the system if
63 \fB\-d\fR
64 \fIHOME_DIR\fR
65 is not specified\&.
66 \fIBASE_DIR\fR
67 is concatenated with the account name to define the home directory\&. If the
68 \fB\-m\fR
69 option is not used,
70 \fIBASE_DIR\fR
71 must exist\&.
72 .sp
73 If this option is not specified,
74 \fBuseradd\fR
75 will use the base directory specified by the
76 \fBHOME\fR
77 variable in
78 /etc/default/useradd, or
79 /home
80 by default\&.
81 .RE
82 .PP
83 \fB\-c\fR, \fB\-\-comment\fR\fIKOMMENTAR\fR
84 .RS 4
85 Any text string\&. It is generally a short description of the login, and is currently used as the field for the user\*(Aqs full name\&.
86 .RE
87 .PP
88 \fB\-d\fR, \fB\-\-home\fR\fIHEM_KAT\fR
89 .RS 4
90 The new user will be created using
91 \fIHOME_DIR\fR
92 as the value for the user\*(Aqs login directory\&. The default is to append the
93 \fILOGIN\fR
94 name to
95 \fIBASE_DIR\fR
96 and use that as the login directory name\&. The directory
97 \fIHOME_DIR\fR
98 does not have to exist but will not be created if it is missing\&.
99 .RE
100 .PP
101 \fB\-D\fR, \fB\-\-defaults\fR
102 .RS 4
103 See below, the subsection "Changing the default values"\&.
104 .RE
105 .PP
106 \fB\-e\fR, \fB\-\-expiredate\fR\fIUTG\(oANGSDATUM\fR
107 .RS 4
108 The date on which the user account will be disabled\&. The date is specified in the format
109 \fIYYYY\-MM\-DD\fR\&.
110 .sp
111 If not specified,
112 \fBuseradd\fR
113 will use the default expiry date specified by the
114 \fBEXPIRE\fR
115 variable in
116 /etc/default/useradd, or an empty string (no expiry) by default\&.
117 .RE
118 .PP
119 \fB\-f\fR, \fB\-\-inactive\fR\fIINAKTIV\fR
120 .RS 4
121 The number of days after a password expires until the account is permanently disabled\&. A value of 0 disables the account as soon as the password has expired, and a value of \-1 disables the feature\&.
122 .sp
123 If not specified,
124 \fBuseradd\fR
125 will use the default inactivity period specified by the
126 \fBINACTIVE\fR
127 variable in
128 /etc/default/useradd, or \-1 by default\&.
129 .RE
130 .PP
131 \fB\-g\fR, \fB\-\-gid\fR\fIGRUPP\fR
132 .RS 4
133 The group name or number of the user\*(Aqs initial login group\&. The group name must exist\&. A group number must refer to an already existing group\&.
134 .sp
135 If not specified, the bahavior of
136 \fBuseradd\fR
137 will depend on the
138 \fBUSERGROUPS_ENAB\fR
139 variable in
140 /etc/login\&.defs\&. If this variable is set to
141 \fIyes\fR
142 (or
143 \fB\-U/\-\-user\-group\fR
144 is specified on the command line), a group will be created for the user, with the same name as her loginname\&. If the variable is set to
145 \fIno\fR
146 (or
147 \fB\-N/\-\-no\-user\-group\fR
148 is specified on the command line), useradd will set the primary group of the new user to the value specified by the
149 \fBGROUP\fR
150 variable in
151 /etc/default/useradd, or 100 by default\&.
152 .RE
153 .PP
154 \fB\-G\fR, \fB\-\-groups\fR\fIGRUPP1\fR[\fI,GRUPP2,\&.\&.\&.\fR[\fI,GRUPPN\fR]]]
155 .RS 4
156 A list of supplementary groups which the user is also a member of\&. Each group is separated from the next by a comma, with no intervening whitespace\&. The groups are subject to the same restrictions as the group given with the
157 \fB\-g\fR
158 option\&. The default is for the user to belong only to the initial group\&.
159 .RE
160 .PP
161 \fB\-h\fR, \fB\-\-help\fR
162 .RS 4
163 Visa hj\(:alpmeddelande och avsluta\&.
164 .RE
165 .PP
166 \fB\-k\fR, \fB\-\-skel\fR \fISKEL_DIR\fR
167 .RS 4
168 The skeleton directory, which contains files and directories to be copied in the user\*(Aqs home directory, when the home directory is created by
169 \fBuseradd\fR\&.
170 .sp
171 This option is only valid if the
172 \fB\-m\fR
173 (or
174 \fB\-\-create\-home\fR) option is specified\&.
175 .sp
176 If this option is not set, the skeleton directory is defined by the
177 \fBSKEL\fR
178 variable in
179 /etc/default/useradd
180 or, by default,
181 /etc/skel\&.
182 .RE
183 .PP
184 \fB\-K\fR, \fB\-\-key\fR\fINYCKEL\fR=\fIV\(:ARDE\fR
185 .RS 4
186 Overrides
187 /etc/login\&.defs
188 defaults (\fBUID_MIN\fR,
189 \fBUID_MAX\fR,
190 \fBUMASK\fR,
191 \fBPASS_MAX_DAYS\fR
192 and others)\&.
193
194 Example:
195 \fB\-K \fR\fIPASS_MAX_DAYS\fR=\fI\-1\fR
196 can be used when creating system account to turn off password ageing, even though system account has no password at all\&. Multiple
197 \fB\-K\fR
198 options can be specified, e\&.g\&.:
199 \fB\-K \fR
200 \fIUID_MIN\fR=\fI100\fR
201 \fB\-K \fR
202 \fIUID_MAX\fR=\fI499\fR
203 .sp
204 Notera:
205 \fB\-K \fR\fIUID_MIN\fR=\fI10\fR,\fIUID_MAX\fR=\fI499\fR
206 fungerar \(:annu inte\&.
207 .RE
208 .PP
209 \fB\-l\fR, \fB\-\-no\-log\-init\fR
210 .RS 4
211 Do not add the user to the lastlog and faillog databases\&.
212 .sp
213 By default, the user\*(Aqs entries in the lastlog and faillog databases are resetted to avoid reusing the entry from a previously deleted user\&.
214 .RE
215 .PP
216 \fB\-m\fR, \fB\-\-create\-home\fR
217 .RS 4
218 Create the user\*(Aqs home directory if it does not exist\&. The files and directories contained in the skeleton directory (which can be defined with the
219 \fB\-k\fR
220 option) will be copied to the home directory\&.
221 .sp
222 By default, no home directories are created\&.
223 .RE
224 .PP
225 \fB\-M\fR
226 .RS 4
227 Do no create the user\*(Aqs home directory, even if the system wide setting from
228 /etc/login\&.defs
229 (\fBCREATE_HOME\fR) is set to
230 \fIyes\fR\&.
231 .RE
232 .PP
233 \fB\-N\fR, \fB\-\-no\-user\-group\fR
234 .RS 4
235 Do not create a group with the same name as the user, but add the user to the group specified by the
236 \fB\-g\fR
237 option or by the
238 \fBGROUP\fR
239 variable in
240 /etc/default/useradd\&.
241 .sp
242 The default behavior (if the
243 \fB\-g\fR,
244 \fB\-N\fR, and
245 \fB\-U\fR
246 options are not specified) is defined by the
247 \fBUSERGROUPS_ENAB\fR
248 variable in
249 /etc/login\&.defs\&.
250 .RE
251 .PP
252 \fB\-o\fR, \fB\-\-non\-unique\fR
253 .RS 4
254 Allow the creation of a user account with a duplicate (non\-unique) UID\&.
255 .sp
256 This option is only valid in combination with the
257 \fB\-o\fR
258 option\&.
259 .RE
260 .PP
261 \fB\-p\fR, \fB\-\-password\fR\fIL\(:OSENORD\fR
262 .RS 4
263 The encrypted password, as returned by
264 \fBcrypt\fR(3)\&. The default is to disable the password\&.
265 .sp
266
267 \fBNote:\fR
268 This option is not recommended because the password (or encrypted password) will be visible by users listing the processes\&.
269 .sp
270 You should make sure the password respects the system\*(Aqs password policy\&.
271 .RE
272 .PP
273 \fB\-r\fR, \fB\-\-system\fR
274 .RS 4
275 Create a system account\&.
276 .sp
277 System users will be created with no aging information in
278 /etc/shadow, and their numeric identifiers are choosen in the
279 \fBSYS_UID_MIN\fR\-\fBSYS_UID_MAX\fR
280 range, defined in
281 /etc/login\&.defs, instead of
282 \fBUID_MIN\fR\-\fBUID_MAX\fR
283 (and their
284 \fBGID\fR
285 counterparts for the creation of groups)\&.
286 .sp
287 Note that
288 \fBuseradd\fR
289 will not create a home directory for such an user, regardless of the default setting in
290 /etc/login\&.defs
291 (\fBCREATE_HOME\fR)\&. You have to specify the
292 \fB\-m\fR
293 options if you want a home directory for a system account to be created\&.
294 .RE
295 .PP
296 \fB\-s\fR, \fB\-\-shell\fR\fISKAL\fR
297 .RS 4
298 The name of the user\*(Aqs login shell\&. The default is to leave this field blank, which causes the system to select the default login shell specified by the
299 \fBSHELL\fR
300 variable in
301 /etc/default/useradd, or an empty string by default\&.
302 .RE
303 .PP
304 \fB\-u\fR, \fB\-\-uid\fR\fIUID\fR
305 .RS 4
306 The numerical value of the user\*(Aqs ID\&. This value must be unique, unless the
307 \fB\-o\fR
308 option is used\&. The value must be non\-negative\&. The default is to use the smallest ID value greater than 999 and greater than every other user\&. Values between 0 and 999 are typically reserved for system accounts\&.
309 .RE
310 .PP
311 \fB\-U\fR, \fB\-\-user\-group\fR
312 .RS 4
313 Create a group with the same name as the user, and add the user to this group\&.
314 .sp
315 The default behavior (if the
316 \fB\-g\fR,
317 \fB\-N\fR, and
318 \fB\-U\fR
319 options are not specified) is defined by the
320 \fBUSERGROUPS_ENAB\fR
321 variable in
322 /etc/login\&.defs\&.
323 .RE
324 .PP
325 \fB\-Z\fR, \fB\-\-selinux\-user\fR \fISEUSER\fR
326 .RS 4
327 The SELinux user for the user\*(Aqs login\&. The default is to leave this field blank, which causes the system to select the default SELinux user\&.
328 .RE
329 .SS "\(:Andrar standardv\(:arden"
330 .PP
331 When invoked with only the
332 \fB\-D\fR
333 option,
334 \fBuseradd\fR
335 will display the current default values\&. When invoked with
336 \fB\-D\fR
337 plus other options,
338 \fBuseradd\fR
339 will update the default values for the specified options\&. Valid default\-changing options are:
340 .PP
341 \fB\-b\fR, \fB\-\-base\-dir\fR \fIBASE_DIR\fR
342 .RS 4
343 The path prefix for a new user\*(Aqs home directory\&. The user\*(Aqs name will be affixed to the end of
344 \fIBASE_DIR\fR
345 to form the new user\*(Aqs home directory name, if the
346 \fB\-d\fR
347 option is not used when creating a new account\&.
348 .sp
349 This option sets the
350 \fBHOME\fR
351 variable in
352 /etc/default/useradd\&.
353 .RE
354 .PP
355 \fB\-e\fR, \fB\-\-expiredate\fR\fIUTG\(oANGSDATUM\fR
356 .RS 4
357 Datumet n\(:ar anv\(:andarkontot blir inaktiverat\&.
358 .sp
359 This option sets the
360 \fBEXPIRE\fR
361 variable in
362 /etc/default/useradd\&.
363 .RE
364 .PP
365 \fB\-f\fR, \fB\-\-inactive\fR\fIINAKTIV\fR
366 .RS 4
367 Antalet dagar efter att ett l\(:osenord har g\(oatt ut innan kontot kommer att inaktiveras\&.
368 .sp
369 This option sets the
370 \fBINACTIVE\fR
371 variable in
372 /etc/default/useradd\&.
373 .RE
374 .PP
375 \fB\-g\fR, \fB\-\-gid\fR\fIGRUPP\fR
376 .RS 4
377 The group name or ID for a new user\*(Aqs initial group (when the
378 \fB\-N/\-\-no\-user\-group\fR
379 is used or when the
380 \fBUSERGROUPS_ENAB\fR
381 variable is set to
382 \fIno\fR
383 in
384 /etc/login\&.defs\&. The named group must exist, and a numerical group ID must have an existing entry\&.
385 .sp
386 This option sets the
387 \fBGROUP\fR
388 variable in
389 /etc/default/useradd\&.
390 .RE
391 .PP
392 \fB\-s\fR, \fB\-\-shell\fR\fISKAL\fR
393 .RS 4
394 The name of a new user\*(Aqs login shell\&.
395 .sp
396 This option sets the
397 \fBSHELL\fR
398 variable in
399 /etc/default/useradd\&.
400 .RE
401 .SH "NOTERINGAR"
402 .PP
403 The system administrator is responsible for placing the default user files in the
404 /etc/skel/
405 directory (or any other skeleton directory specified in
406 /etc/default/useradd
407 or on the command line)\&.
408 .SH "T\(:ANK P\(oA"
409 .PP
410 You may not add a user to a NIS or LDAP group\&. This must be performed on the corresponding server\&.
411 .PP
412 Similarly, if the username already exists in an external user database such as NIS or LDAP,
413 \fBuseradd\fR
414 will deny the user account creation request\&.
415 .PP
416 Usernames must start with a lower case letter or an underscore, followed by lower case letters, digits, underscores, or dashes\&. They can end with a dollar sign\&. In regular expression terms: [a\-z_][a\-z0\-9_\-]*[$]?
417 .PP
418 Usernames may only be up to 32 characters long\&.
419 .SH "CONFIGURATION"
420 .PP
421 The following configuration variables in
422 /etc/login\&.defs
423 change the behavior of this tool:
424 .PP
425 \fBCREATE_HOME\fR (boolean)
426 .RS 4
427 Indicate if a home directory should be created by default for new users\&.
428 .sp
429 This setting does not apply to system users, and can be overriden on the command line\&.
430 .RE
431 .PP
432 \fBGID_MAX\fR (number), \fBGID_MIN\fR (number)
433 .RS 4
434 Range of group IDs used for the creation of regular groups by
435 \fBuseradd\fR,
436 \fBgroupadd\fR, or
437 \fBnewusers\fR\&.
438 .RE
439 .PP
440 \fBMAIL_DIR\fR (string)
441 .RS 4
442 The mail spool directory\&. This is needed to manipulate the mailbox when its corresponding user account is modified or deleted\&. If not specified, a compile\-time default is used\&.
443 .RE
444 .PP
445 \fBMAIL_FILE\fR (string)
446 .RS 4
447 Defines the location of the users mail spool files relatively to their home directory\&.
448 .RE
449 .PP
450 The
451 \fBMAIL_DIR\fR
452 and
453 \fBMAIL_FILE\fR
454 variables are used by
455 \fBuseradd\fR,
456 \fBusermod\fR, and
457 \fBuserdel\fR
458 to create, move, or delete the user\*(Aqs mail spool\&.
459 .PP
460 If
461 \fBMAIL_CHECK_ENAB\fR
462 is set to
463 \fIyes\fR, they are also used to define the
464 \fBMAIL\fR
465 environment variable\&.
466 .PP
467 \fBMAX_MEMBERS_PER_GROUP\fR (number)
468 .RS 4
469 Maximum members per group entry\&. When the maximum is reached, a new group entry (line) is started in
470 /etc/group
471 (with the same name, same password, and same GID)\&.
472 .sp
473 The default value is 0, meaning that there are no limits in the number of members in a group\&.
474 .sp
475 This feature (split group) permits to limit the length of lines in the group file\&. This is useful to make sure that lines for NIS groups are not larger than 1024 characters\&.
476 .sp
477 If you need to enforce such limit, you can use 25\&.
478 .sp
479 Note: split groups may not be supported by all tools (even in the Shadow toolsuite)\&. You should not use this variable unless you really need it\&.
480 .RE
481 .PP
482 \fBPASS_MAX_DAYS\fR (number)
483 .RS 4
484 The maximum number of days a password may be used\&. If the password is older than this, a password change will be forced\&. If not specified, \-1 will be assumed (which disables the restriction)\&.
485 .RE
486 .PP
487 \fBPASS_MIN_DAYS\fR (number)
488 .RS 4
489 The minimum number of days allowed between password changes\&. Any password changes attempted sooner than this will be rejected\&. If not specified, \-1 will be assumed (which disables the restriction)\&.
490 .RE
491 .PP
492 \fBPASS_WARN_AGE\fR (number)
493 .RS 4
494 The number of days warning given before a password expires\&. A zero means warning is given only upon the day of expiration, a negative value means no warning is given\&. If not specified, no warning will be provided\&.
495 .RE
496 .PP
497 \fBSYS_GID_MAX\fR (number), \fBSYS_GID_MIN\fR (number)
498 .RS 4
499 Range of group IDs used for the creation of system groups by
500 \fBuseradd\fR,
501 \fBgroupadd\fR, or
502 \fBnewusers\fR\&.
503 .RE
504 .PP
505 \fBSYS_UID_MAX\fR (number), \fBSYS_UID_MIN\fR (number)
506 .RS 4
507 Range of user IDs used for the creation of system users by
508 \fBuseradd\fR
509 or
510 \fBnewusers\fR\&.
511 .RE
512 .PP
513 \fBUID_MAX\fR (number), \fBUID_MIN\fR (number)
514 .RS 4
515 Range of user IDs used for the creation of regular users by
516 \fBuseradd\fR
517 or
518 \fBnewusers\fR\&.
519 .RE
520 .PP
521 \fBUMASK\fR (number)
522 .RS 4
523 The file mode creation mask is initialized to this value\&. If not specified, the mask will be initialized to 022\&.
524 .sp
525
526 \fBuseradd\fR
527 and
528 \fBnewusers\fR
529 use this mask to set the mode of the home directory they create
530 .sp
531 It is also used by
532 \fBlogin\fR
533 to define users\*(Aq initial umask\&. Note that this mask can be overriden by the user\*(Aqs GECOS line (if
534 \fBQUOTAS_ENAB\fR
535 is set) or by the specification of a limit with the
536 \fIK\fR
537 identifier in
538 \fBlimits\fR(5)\&.
539 .RE
540 .PP
541 \fBUSERGROUPS_ENAB\fR (boolean)
542 .RS 4
543 Enable setting of the umask group bits to be the same as owner bits (examples: 022 \-> 002, 077 \-> 007) for non\-root users, if the uid is the same as gid, and username is the same as the primary group name\&.
544 .sp
545 If set to
546 \fIyes\fR,
547 \fBuserdel\fR
548 will remove the user\*(Aqs group if it contains no more members, and
549 \fBuseradd\fR
550 will create by default a group with the name of the user\&.
551 .RE
552 .SH "FILER"
553 .PP
554 /etc/passwd
555 .RS 4
556 Anv\(:andarkontoinformation\&.
557 .RE
558 .PP
559 /etc/shadow
560 .RS 4
561 S\(:aker anv\(:andarkontoinformation\&.
562 .RE
563 .PP
564 /etc/group
565 .RS 4
566 Gruppkontoinformation\&.
567 .RE
568 .PP
569 /etc/gshadow
570 .RS 4
571 S\(:aker gruppkontoinformation\&.
572 .RE
573 .PP
574 /etc/default/useradd
575 .RS 4
576 Standardv\(:arden f\(:or skapande av konto\&.
577 .RE
578 .PP
579 /etc/skel/
580 .RS 4
581 Katalog som inneh\(oaller standardfiler\&.
582 .RE
583 .PP
584 /etc/login\&.defs
585 .RS 4
586 Shadow password suite configuration\&.
587 .RE
588 .SH "AVSLUTNINGSV\(:ARDEN"
589 .PP
590 Kommandot
591 \fBuseradd\fR
592 avslutas med f\(:oljande v\(:arden:
593 .PP
594 \fI0\fR
595 .RS 4
596 lyckad
597 .RE
598 .PP
599 \fI1\fR
600 .RS 4
601 kan inte uppdatera l\(:osenordsfilen
602 .RE
603 .PP
604 \fI2\fR
605 .RS 4
606 ogiltig kommandosyntax
607 .RE
608 .PP
609 \fI3\fR
610 .RS 4
611 ogiltigt argument till flagga
612 .RE
613 .PP
614 \fI4\fR
615 .RS 4
616 UID anv\(:ands redan (och inget
617 \fB\-o\fR)
618 .RE
619 .PP
620 \fI6\fR
621 .RS 4
622 angiven grupp finns inte
623 .RE
624 .PP
625 \fI9\fR
626 .RS 4
627 anv\(:andarnamnet anv\(:ands redan
628 .RE
629 .PP
630 \fI10\fR
631 .RS 4
632 kan inte uppdatera gruppfilen
633 .RE
634 .PP
635 \fI12\fR
636 .RS 4
637 kan inte skapa hemkatalog
638 .RE
639 .PP
640 \fI13\fR
641 .RS 4
642 kan inte skapa postk\(:o
643 .RE
644 .SH "SE OCKS\(oA"
645 .PP
646 \fBchfn\fR(1),
647 \fBchsh\fR(1),
648 \fBpasswd\fR(1),
649 \fBcrypt\fR(3),
650 \fBgroupadd\fR(8),
651 \fBgroupdel\fR(8),
652 \fBgroupmod\fR(8),
653 \fBlogin.defs\fR(5),
654 \fBnewusers\fR(8),
655 \fBuserdel\fR(8),
656 \fBusermod\fR(8)\&.