1CHPASSWD(8) System Management Commands CHPASSWD(8)
2
3
4
6 chpasswd - update passwords in batch mode
7
9 chpasswd [options]
10
12 The chpasswd command reads a list of user name and password pairs from
13 standard input and uses this information to update a group of existing
14 users. Each line is of the format:
15
16 user_name:password
17
18 By default the passwords must be supplied in clear-text, and are
19 encrypted by chpasswd. Also the password age will be updated, if
20 present.
21
22 The default encryption algorithm can be defined for the system with the
23 ENCRYPT_METHOD or MD5_CRYPT_ENAB variables of /etc/login.defs, and can
24 be overwritten with the -e, -m, or -c options.
25
26 chpasswd first updates all the passwords in memory, and then commits
27 all the changes to disk if no errors occurred for any user.
28
29 This command is intended to be used in a large system environment where
30 many accounts are created at a single time.
31
33 The options which apply to the chpasswd command are:
34
35 -c, --crypt-method METHOD
36 Use the specified method to encrypt the passwords.
37
38 The available methods are DES, MD5, NONE, and SHA256 or SHA512 if
39 your libc support these methods.
40
41 By default (if none of the -c, -m, or -e options are specified),
42 the encryption method is defined by the ENCRYPT_METHOD or
43 MD5_CRYPT_ENAB variables of /etc/login.defs.
44
45 -e, --encrypted
46 Supplied passwords are in encrypted form.
47
48 -h, --help
49 Display help message and exit.
50
51 -m, --md5
52 Use MD5 encryption instead of DES when the supplied passwords are
53 not encrypted.
54
55 -R, --root CHROOT_DIR
56 Apply changes in the CHROOT_DIR directory and use the configuration
57 files from the CHROOT_DIR directory.
58
59 -s, --sha-rounds ROUNDS
60 Use the specified number of rounds to encrypt the passwords.
61
62 The value 0 means that the system will choose the default number of
63 rounds for the crypt method (5000).
64
65 A minimal value of 1000 and a maximal value of 999,999,999 will be
66 enforced.
67
68 You can only use this option with the SHA256 or SHA512 crypt
69 method.
70
71 By default, the number of rounds is defined by the
72 SHA_CRYPT_MIN_ROUNDS and SHA_CRYPT_MAX_ROUNDS variables in
73 /etc/login.defs.
74
76 Remember to set permissions or umask to prevent readability of
77 unencrypted files by other users.
78
80 The following configuration variables in /etc/login.defs change the
81 behavior of this tool:
82
83 ENCRYPT_METHOD (string)
84 This defines the system default encryption algorithm for encrypting
85 passwords (if no algorithm are specified on the command line).
86
87 It can take one of these values: DES (default), MD5, SHA256,
88 SHA512.
89
90 Note: this parameter overrides the MD5_CRYPT_ENAB variable.
91
92 MD5_CRYPT_ENAB (boolean)
93 Indicate if passwords must be encrypted using the MD5-based
94 algorithm. If set to yes, new passwords will be encrypted using the
95 MD5-based algorithm compatible with the one used by recent releases
96 of FreeBSD. It supports passwords of unlimited length and longer
97 salt strings. Set to no if you need to copy encrypted passwords to
98 other systems which don't understand the new algorithm. Default is
99 no.
100
101 This variable is superseded by the ENCRYPT_METHOD variable or by
102 any command line option used to configure the encryption algorithm.
103
104 This variable is deprecated. You should use ENCRYPT_METHOD.
105
106 SHA_CRYPT_MIN_ROUNDS (number), SHA_CRYPT_MAX_ROUNDS (number)
107 When ENCRYPT_METHOD is set to SHA256 or SHA512, this defines the
108 number of SHA rounds used by the encryption algorithm by default
109 (when the number of rounds is not specified on the command line).
110
111 With a lot of rounds, it is more difficult to brute forcing the
112 password. But note also that more CPU resources will be needed to
113 authenticate users.
114
115 If not specified, the libc will choose the default number of rounds
116 (5000).
117
118 The values must be inside the 1000-999,999,999 range.
119
120 If only one of the SHA_CRYPT_MIN_ROUNDS or SHA_CRYPT_MAX_ROUNDS
121 values is set, then this value will be used.
122
123 If SHA_CRYPT_MIN_ROUNDS > SHA_CRYPT_MAX_ROUNDS, the highest value
124 will be used.
125
127 /etc/passwd
128 User account information.
129
130 /etc/shadow
131 Secure user account information.
132
133 /etc/login.defs
134 Shadow password suite configuration.
135
137 passwd(1), newusers(8), login.defs(5), useradd(8).
138
139
140
141shadow-utils 4.8.1 11/16/2020 CHPASSWD(8)