C.W.K.
Stream
Lesson 07 of 12 · published

여러 키

~15 min · multiple-keys, identityfile, identitiesonly, github

Level 0Pinger
0 XP0/101 lessons0/12 achievements
0/150 XP to next level150 XP to go0% complete

용도당 키 하나

조만간 용도별 별도 키 — 개인 vs 회사, GitHub vs 클라우드 provider, 백업 전용 키 등. ~/.ssh/config 가 host 별로 맞는 키 골라.

IdentitiesOnly 함정

디폴트로 ssh-agent 에 여러 키 로드되면 SSH 가 차례로 다 제공. 서버가 낮은 MaxAuthTries(디폴트: 6) 면 — 맞는 키 시도되기 전에 틀린 키들로 허용 시도 다 태움 — "Too many authentication failures". 그게 증상. Fix 가 IdentitiesOnly yes — "이 host 에 listed 된 IdentityFile 만 제공, agent 의 다른 거 무시."

Code

Host 별 다른 키·ssh-config
# Personal home fleet — default key
Host office server music
    User you_username
    IdentityFile ~/.ssh/id_ed25519

# Work hosts — separate work key
Host *.work.com
    User you_username.kim
    IdentityFile ~/.ssh/id_ed25519_work

# GitHub — dedicated key
Host github.com
    HostName github.com
    User git
    IdentityFile ~/.ssh/id_ed25519_github

# Always force only the IdentityFile, never auto-try other keys
Host *
    IdentitiesOnly yes
    AddKeysToAgent yes
    UseKeychain yes

External links

Exercise

ssh-add -l 돌려서 agent 에 로드된 키 몇 개 봐. 2 개 넘으면 IdentitiesOnly yes 문제 후보. Host * 에 추가, 각 Host block 에 명시 IdentityFile. 가장 중요한 연결들 여전히 동작하는지 테스트.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.