bash – 解密目录中的多个OpenPGP文件
发布时间:2020-12-15 19:05:35 所属栏目:安全 来源:网络整理
导读:我在目录中有几百gpg加密文件,格式为filename.xyz.gpg,其中“xyz”是一些任意扩展名。我需要解密所有的文件,以生成filename.xyz,这样我就不需要手动输入每个文件的密码。 我已经尝试了以下目录“测试”: for file in 'ls Testing'; do (echo password|g
我在目录中有几百gpg加密文件,格式为filename.xyz.gpg,其中“xyz”是一些任意扩展名。我需要解密所有的文件,以生成filename.xyz,这样我就不需要手动输入每个文件的密码。
我已经尝试了以下目录“测试”: for file in 'ls Testing'; do (echo <password>|gpg --passphrase-fd 0 -d $file --output $file.decrypted); 我刚刚用命令提示符>结束,没有任何反应。 我的语法有什么问题?有没有一个更有效的方式来做这个没有bash shell循环?
正如手册中所说,您需要添加–batch选项:
--passphrase-fd n Read the passphrase from file descriptor n. Only the first line will be read from file descriptor n. If you use 0 for n,the passphrase will be read from STDIN. This can only be used if only one passphrase is supplied. Note that this passphrase is only used if the option --batch has also been given. This is different from gpg. --passphrase string Use string as the passphrase. This can only be used if only one passphrase is supplied. Obviously,this is of very questionable security on a multi-user sys |