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

Full Config Block

~15 min · ssh-config, directives, compression, keepalive

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

완전한 Host block 의 해부

흔히 쓰는 모든 directive, 한 자리에. 대부분 block 은 일부만 필요하지만 뭐가 있는지 알면 바퀴 다시 발명 안 함.

매일 가장 중요한 directive

Directive용도
HostName실제 주소 (IP 또는 FQDN)
User원격 username
PortSSH 포트 (기본 22)
IdentityFileprivate key path
IdentitiesOnlyagent 의 모든 키 시도 X — IdentityFile 만
ForwardAgentagent forward (디폴트 no, 그대로 둬)
ProxyJump이 host 먼저 hop (다음 레슨)
Compression느린 link 에 compression (빠른 LAN 엔 off)
ServerAliveIntervalN 초마다 keepalive
ServerAliveCountMaxN 번 keepalive 놓치면 끊음
AddKeysToAgent사용된 키 자동으로 agent 추가
UseKeychainmacOS — passphrase Keychain 에서 가져옴
ControlMaster / Path / Persist연결 multiplex (뒷 레슨)

들여쓰기는 관습이지 규칙 아님

SSH 는 들여쓰기 없어도 잘 파싱하지만 host 20 개일 때 들여쓴 block 이 극적으로 더 읽기 쉬워. 스타일 골라서 일관 유지.

Code

Fully-loaded block·ssh-config
Host office
    HostName 192.168.1.100      # IP or FQDN
    User you_username                  # remote username
    Port 22                      # SSH port
    IdentityFile ~/.ssh/id_ed25519_office
    IdentitiesOnly yes           # only try this key
    ForwardAgent no              # keep agent here, not forwarded
    Compression no               # fast LAN, no compression
    ServerAliveInterval 60       # keepalive every 60s
    ServerAliveCountMax 3        # disconnect after 3 misses (3 min total)
    AddKeysToAgent yes
    UseKeychain yes              # macOS only

External links

Exercise

가장 많이 쓰는 host alias 골라. Block 열어서 최소 다음 있는지 확인 — HostName, User, IdentityFile, ServerAliveInterval, AddKeysToAgent. 빠진 거 추가. 그다음 ssh -G that-host 돌려서 해석된 설정 훑어 — Host * 의 상속된 디폴트 + 네 block 의 override 다 보임.

Progress

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

댓글 0

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

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