use*_*531 5 security encryption key-authentication gpg
尝试创建将用于托管在我的 Centos7 机器上的 apt 存储库的 GPG 密钥。我创建了一个新用户“apt”,然后尝试创建密钥,但最后,它指出我需要一个密码短语,但随后立即关闭说明被用户取消。不,不是!
从那以后,我成功地重复了这些相同的步骤 root 并作为我的标准用户名,它恰好在轮组中。
两个问题:
谢谢
[apt@devserver ~]$ gpg --gen-key
gpg (GnuPG) 2.0.22; Copyright (C) 2013 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Please select what kind of key you want:
(1) RSA and RSA (default)
(2) DSA and Elgamal
(3) DSA (sign only)
(4) RSA (sign only)
Your selection?
RSA keys may be between 1024 and 4096 bits long.
What keysize do you want? (2048)
Requested keysize is 2048 bits
Please specify how long the key should be valid.
0 = key does not expire
<n> = key expires in n days
<n>w = key expires in n weeks
<n>m = key expires in n months
<n>y = key expires in n years
Key is valid for? (0) 1y
Key expires at Thu 12 Jul 2018 04:32:05 PM UTC
Is this correct? (y/N) y
GnuPG needs to construct a user ID to identify your key.
Real name: somename
Email address: example@gmail.com
Comment:
You selected this USER-ID:
"somename <example@gmail.com>"
Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O
You need a Passphrase to protect your secret key.
gpg: cancelled by user
gpg: Key generation canceled.
[apt@devserver ~]$
Run Code Online (Sandbox Code Playgroud)
der*_*ert 13
至于“被用户取消”错误:GnuPG 试图确保它直接从终端读取密码,而不是(例如)从标准输入管道读取。为此,它会尝试直接打开 tty。不幸的是,文件权限妨碍了 — tty 设备归您登录的用户所有。所以只有那个用户和 root 可以打开它。GnuPG 似乎错误地报告了错误,说您取消了(实际上它的权限被拒绝了)。
至于您是否应该为存储库设置单独的密钥:是的。有几个原因让我想到:
使用您的个人密钥对存储库密钥进行签名是很正常的。
至于以 root 身份运行密钥生成:不理想(不要在没有充分理由的情况下以 root 身份运行),但可能不是真正的问题。