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. MD5 and DES should not be used for new hashes, see crypt(5)
89 for recommendations.
90
91 Note: this parameter overrides the MD5_CRYPT_ENAB variable.
92
93 MD5_CRYPT_ENAB (boolean)
94 Indicate if passwords must be encrypted using the MD5-based
95 algorithm. If set to yes, new passwords will be encrypted using the
96 MD5-based algorithm compatible with the one used by recent releases
97 of FreeBSD. It supports passwords of unlimited length and longer
98 salt strings. Set to no if you need to copy encrypted passwords to
99 other systems which don't understand the new algorithm. Default is
100 no.
101
102 This variable is superseded by the ENCRYPT_METHOD variable or by
103 any command line option used to configure the encryption algorithm.
104
105 This variable is deprecated. You should use ENCRYPT_METHOD.
106
107 SHA_CRYPT_MIN_ROUNDS (number), SHA_CRYPT_MAX_ROUNDS (number)
108 When ENCRYPT_METHOD is set to SHA256 or SHA512, this defines the
109 number of SHA rounds used by the encryption algorithm by default
110 (when the number of rounds is not specified on the command line).
111
112 With a lot of rounds, it is more difficult to brute forcing the
113 password. But note also that more CPU resources will be needed to
114 authenticate users.
115
116 If not specified, the libc will choose the default number of rounds
117 (5000), which is orders of magnitude too low for modern hardware.
118
119 The values must be inside the 1000-999,999,999 range.
120
121 If only one of the SHA_CRYPT_MIN_ROUNDS or SHA_CRYPT_MAX_ROUNDS
122 values is set, then this value will be used.
123
124 If SHA_CRYPT_MIN_ROUNDS > SHA_CRYPT_MAX_ROUNDS, the highest value
125 will be used.
126
128 /etc/passwd
129 User account information.
130
131 /etc/shadow
132 Secure user account information.
133
134 /etc/login.defs
135 Shadow password suite configuration.
136
138 passwd(1), newusers(8), login.defs(5), useradd(8).
139
140
141
142shadow-utils 4.11.1 02/10/2022 CHPASSWD(8)