crypt 命令加密基于 DES 加密算法。一般情况下可能没有安装在 Linux 发行版上,在 Ubuntu 上可以安装 mcrypt 软件包而获得该命令:
# apt-get install mcrypt
一般使用方法如下:
# crypt <secret.txt> secreted.txt
Unix crypt(1) emulation program using mcrypt(1).
Use crypt -h for more help.
Enter the passphrase (maximum of 512 characters)
Please use a combination of upper and lower case letters and numbers.
Enter passphrase:
Enter passphrase:
Stdin was encrypted.
注意,要加密的文件要被 < > 所括。上面的 Enter passphrase: 是要求输入加密密钥。我们也可以在命令行上直接指定出密码,而不用进入到交互式: