0
제가 사용하는 컴퓨터에 여러 개의 ssh rsa 키가 있습니다. 즉, 다음과 같습니다 ~/.ssh/config
에있는 파일을 가진를 알려준 :여러 ID를 사용하여 로그인 할 때 ssh-agent를 시작하십시오.
#Bit Bucket Account
Host bitbucketid
HostName bitbucket.org
PreferredAuthentications publickey
IdentityFile ~/.ssh/bitbucketid
# Server
Host serverid
HostName website.name
PreferredAuthentications publickey
IdentityFile ~/.ssh/serverid
이 링크를 추가하는 말씀입니다 :
SSH_ENV="$HOME/.ssh/environment"
function start_agent {
echo "Initialising new SSH agent..."
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
echo succeeded
chmod 600 "${SSH_ENV}"
. "${SSH_ENV}" > /dev/null
/usr/bin/ssh-add;
}
# Source SSH settings, if applicable
if [ -f "${SSH_ENV}" ]; then
. "${SSH_ENV}" > /dev/null
#ps ${SSH_AGENT_PID} doesn't work under cywgin
ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
start_agent;
}
else
start_agent;
fi
을 질문 Start ssh-agent on login의 조언을 따른 후, 나는를로드 할 수 있습니다 지금처럼 내 터미널을 열 때 SSH 키 :
Initialising new SSH agent...
succeeded
Identity added: /Users/pc/.ssh/id_rsa (/Users/pc/.ssh/id_rsa)
나는 자동적으로같은 내 다른 RSA 키 중 하나의 신원을 추가 할 수있는 방법 터미널 시작시또는 bitbucketid
?
어떻게 추가 할 수 있습니까? 나는 당신이 의미하는 바를 이해하지 못하고'ssh-add ~/.ssh/serverid'를 .bashrc 파일에 넣지 않는다면 아무 일도하지 않는다. – Daniel
ssh-agent를 시작하는 동안 ssh-add를해야한다. 나는 bashrc가 끝날 때 이것을한다. 나는 링크를 찾으려고 노력할 것이다. – binarycreations
이것은 필요한 것과 비슷합니다. http://stackoverflow.com/questions/16985927/set-ssh-identities-in-bashrc 오류를 게시하십시오. 또한 ssh add에 대한 인수가 비어있는 곳을주의하십시오. – binarycreations