Linux command
mkpasswd 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Generate password hash
mkpasswd [password]
Generate with specific method
mkpasswd -m sha-512 [password]
Generate with salt
mkpasswd -S [salt] [password]
Generate random password
mkpasswd -l [16]
List available methods
mkpasswd -m help
说明
mkpasswd generates password hashes suitable for /etc/shadow or similar uses. It can use various hashing algorithms and optionally generate random passwords. The tool is useful for creating encrypted passwords for system configuration files and automated provisioning.
参数
- -m _method_
- Hash method (sha-512, sha-256, md5, des).
- -S _salt_
- Specify salt value.
- -R _rounds_
- SHA rounds count.
- -l _length_
- Generate random password of length.
- -s, --stdin
- Read password from stdin.
- -5
- Use MD5 (shortcut).
- -P _fd_
- Read password from file descriptor.
FAQ
What is the mkpasswd command used for?
mkpasswd generates password hashes suitable for /etc/shadow or similar uses. It can use various hashing algorithms and optionally generate random passwords. The tool is useful for creating encrypted passwords for system configuration files and automated provisioning.
How do I run a basic mkpasswd example?
Run `mkpasswd [password]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -m _method_ do in mkpasswd?
Hash method (sha-512, sha-256, md5, des).