other languages
CHPASSWD(8) | 系统管理命令 | CHPASSWD(8) |
名称¶
chpasswd - 批量更新密码大纲¶
chpasswd
[ 选项]
描述¶
The chpasswd command reads a list of user name and password pairs from standard input and uses this information to update a group of existing users. Each line is of the format: user_name:password 默认必须明文提供密码,然后由 chpasswd 加密。如果存在密码年龄信息,也会更新之。 By default, passwords are encrypted by PAM, but (even if not recommended) you can select a different encryption method with the -e, -m, or -c options.选项¶
chpasswd 可以接受的选项有: -c, --crypt-methodMETHOD使用指定的方法加密密码。
可用的方法有 DES, MD5, NONE, and SHA256
或 SHA512,前提是您的 libc
支持这写方法。
默认,使用 PAM
来加密密码。
-e, --encrypted
提供的密码是已经加密了的
-h, --help
现实帮助信息并退出。
-m, --md5
如果提供的密码没有加密,则使用
MD5 加密而不是 DES。
-R, --rootCHROOT_DIR
Apply changes in the CHROOT_DIR
directory and use the configuration files from the CHROOT_DIR
directory.
-s, --sha-roundsROUNDS
使用指定次数的轮转来加密密码。
值 0
表示让系统为加密方法选择默认的轮转次数
(5000)。
会强制最小 1,000,最大
9,9999,9999
您只可以对 SHA256 或 SHA512
使用此选项。
By default, the number of rounds is defined by the SHA_CRYPT_MIN_ROUNDS
and SHA_CRYPT_MAX_ROUNDS variables in /etc/login.defs.
CAVEATS¶
记住要设置权限或者掩码来阻止其它用户对未加密文件的读取。配置文件¶
在 /etc/login.defs 中有如下配置变量,可以用来更改此工具的行为: SHA_CRYPT_MIN_ROUNDS (number), SHA_CRYPT_MAX_ROUNDS (number)ENCRYPT_METHOD 设为
SHA256 或 SHA512
时,此项确定加密算法默认使用
SHA
轮转数目(当轮转数没有通过命令行指定时)。
使用很多轮转,会让暴力破解更加困难。但是需要注意,认证用户时也会需要更多的
CPU 资源。
如果没有指定,libc
会选择默认的轮转数(5000)。
值必须在 1000 - 999,999,999 之间。
如果只设置了一个
SHA_CRYPT_MIN_ROUNDS 或 SHA_CRYPT_MAX_ROUNDS
值,就会使用这个值。
如果 SHA_CRYPT_MIN_ROUNDS >
SHA_CRYPT_MAX_ROUNDS,将会使用大的那个。
注意:这只影响组密码的产生。用户密码的产生是由
PAM 和 PAM
配置负责的。建议设置此变量和
PAM 配置一致。
文件¶
/etc/passwd用户账户信息。
/etc/shadow
安全用户账户信息。
/etc/login.defs
Shadow
密码套件配置。
/etc/pam.d/chpasswd
chpasswd 的 PAM
配置。
参见¶
passwd(1), newusers(8), login.defs(5),useradd(8).2012-05-25 | shadow-utils 4.1.5.1 |