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. Only absolute paths are
58 supported.
59
60 -s, --sha-rounds ROUNDS
61 Use the specified number of rounds to encrypt the passwords.
62
63 The value 0 means that the system will choose the default number of
64 rounds for the crypt method (5000).
65
66 A minimal value of 1000 and a maximal value of 999,999,999 will be
67 enforced.
68
69 You can only use this option with the SHA256 or SHA512 crypt
70 method.
71
72 By default, the number of rounds is defined by the
73 SHA_CRYPT_MIN_ROUNDS and SHA_CRYPT_MAX_ROUNDS variables in
74 /etc/login.defs.
75
77 Remember to set permissions or umask to prevent readability of
78 unencrypted files by other users.
79
81 The following configuration variables in /etc/login.defs change the
82 behavior of this tool:
83
84 ENCRYPT_METHOD (string)
85 This defines the system default encryption algorithm for encrypting
86 passwords (if no algorithm are specified on the command line).
87
88 It can take one of these values: DES (default), MD5, SHA256,
89 SHA512. MD5 and DES should not be used for new hashes, see crypt(5)
90 for recommendations.
91
92 Note: this parameter overrides the MD5_CRYPT_ENAB variable.
93
94 MD5_CRYPT_ENAB (boolean)
95 Indicate if passwords must be encrypted using the MD5-based
96 algorithm. If set to yes, new passwords will be encrypted using the
97 MD5-based algorithm compatible with the one used by recent releases
98 of FreeBSD. It supports passwords of unlimited length and longer
99 salt strings. Set to no if you need to copy encrypted passwords to
100 other systems which don't understand the new algorithm. Default is
101 no.
102
103 This variable is superseded by the ENCRYPT_METHOD variable or by
104 any command line option used to configure the encryption algorithm.
105
106 This variable is deprecated. You should use ENCRYPT_METHOD.
107
108 SHA_CRYPT_MIN_ROUNDS (number), SHA_CRYPT_MAX_ROUNDS (number)
109 When ENCRYPT_METHOD is set to SHA256 or SHA512, this defines the
110 number of SHA rounds used by the encryption algorithm by default
111 (when the number of rounds is not specified on the command line).
112
113 With a lot of rounds, it is more difficult to brute forcing the
114 password. But note also that more CPU resources will be needed to
115 authenticate users.
116
117 If not specified, the libc will choose the default number of rounds
118 (5000), which is orders of magnitude too low for modern hardware.
119
120 The values must be inside the 1000-999,999,999 range.
121
122 If only one of the SHA_CRYPT_MIN_ROUNDS or SHA_CRYPT_MAX_ROUNDS
123 values is set, then this value will be used.
124
125 If SHA_CRYPT_MIN_ROUNDS > SHA_CRYPT_MAX_ROUNDS, the highest value
126 will be used.
127
129 /etc/passwd
130 User account information.
131
132 /etc/shadow
133 Secure user account information.
134
135 /etc/login.defs
136 Shadow password suite configuration.
137
139 passwd(1), newusers(8), login.defs(5), useradd(8).
140
141
142
143shadow-utils 4.14.0 10/03/2023 CHPASSWD(8)