Dop*_*oti 14
有点绕,但是:
for possiblekey in ${HOME}/.ssh/id_*; do
if grep -q PRIVATE "$possiblekey"; then
ssh-add "$possiblekey"
fi
done
Run Code Online (Sandbox Code Playgroud)
您还可以在指令之外的自己的指令中将所有键添加到您的~/.ssh/configeach 中:IdentityFileHost
# Global SSH configurations here will be applied to all hosts
IdentityFile ~/.ssh/id_dsa
IdentityFile ~/.ssh/id_project1
IdentityFile ~/.ssh/id_someotherkey
Host somespecifichost.example.com
IdentityFile ~/.ssh/id_specifichostonlykey
Run Code Online (Sandbox Code Playgroud)
后者,老实说,更好,方法具有额外的好处,即不会突然拿起您添加的新密钥,而无需您将其显式添加到“钥匙圈”中。
| 归档时间: |
|
| 查看次数: |
10562 次 |
| 最近记录: |