我有以下脚本:
#!/bin/sh -e PWD="supersecretpassword" file="/backup/2do/example.txt" echo before echo $PWD | gpg --passphrase-fd 0 -c $file echo after
如果手动执行脚本,脚本工作得很好,但是当以crontab方式执行gpg行时,脚本会停止工作。
GPG显示:
gpg: cannot open `/dev/tty': No such device or address
我很感激任何build议!
解决scheme :将--no-tty添加到GPG
添加-vv到gpg命令来查看更多输出。 这可能与一个~/.gnupg缺失有关。
/usr/bin/gpg --no-tty --passphrase-file /home/vouuuuuuuuu/settings/passfile.txt --decrypt-files /home/juhuuu/dirname/*.gpg;
--no-tty cannot open / dev / tty:没有这样的设备或地址 要解决这个问题,只需在你的gpg命令行中添加“–no-tty”选项即可。 答案是从caching的谷歌页面