问题原文
原帖链接 · lonix · CC BY-SA 4.0
When performing an automated server deployment, I can upload and import gpg keys via script. But I cannot trust keys.
I tried
gpg --batch --yes --edit-key keyname trust 5
and
echo 5 | gpg --batch --yes --edit-key keyname trust -
In non-batch mode it always stops to ask for input. In batch mode it ignores input.
What is the correct syntax?
已采纳解答
原帖链接 · lonix · CC BY-SA 4.0
get fingerprint for key "keyname":
FP=$(gpg --list-keys keyname | head -n2 | tail -n1 | tr -d '[:blank:]')
trust key:
echo -e "5\ny\n" | gpg --command-fd 0 --edit-key "$FP" trust
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
