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

Config 파일

~15 min · ssh-config, precedence, ini-format

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

~/.ssh/config — 터미널 사령부

~/.ssh/config 파일이 SSH 를 동사에서 습관으로 바꿔. 매번 긴 flag 수프 치는 대신 — port, user, key, ProxyJump 등 — alias 로 정의된 named host 를 참조해. ssh -p 2222 -i ~/.ssh/id_ed25519_office you_username@192.168.1.100 대신 ssh office.

Precedence 작동 방식

SSH 는 이 순서로 설정 해석 (각 설정마다 first match wins):

  1. 커맨드라인 flag-p 2222 가 아래 모두 override.
  2. ~/.ssh/config — 개인 클라이언트 config.
  3. /etc/ssh/ssh_config — 시스템 전체 디폴트.
  4. OpenSSH built-in 디폴트.

Config 파일 안에서 각 설정마다 first matching Host block 이 이김. 그래서 specific 항목이 general 위로 가고, Host * 는 맨 아래.

Format

들여쓰기된 ini 스타일 파일. 주석은 # 로 시작. 들여쓰기는 관습 — SSH 는 안 들여써도 잘 파싱하지만 들여쓴 블록이 훨씬 읽기 쉬움.

Code

Config 만들기·bash
# Create the file if it doesn't exist
touch ~/.ssh/config
chmod 600 ~/.ssh/config

# Edit it
nano ~/.ssh/config

# Validate the syntax (without connecting)
ssh -G office | head
최소 첫 config·ssh-config
# ~/.ssh/config

# Office Mac Studio on the LAN
Host office
    HostName 192.168.1.100
    User you_username

# Global defaults — last block in the file
Host *
    AddKeysToAgent yes
    UseKeychain yes
    IdentityFile ~/.ssh/id_ed25519
    ServerAliveInterval 60

External links

Exercise

~/.ssh/config 만들거나 열어. 자주 SSH 하는 머신 하나에 단일 Host block 추가. ssh -G that-host 로 해석된 설정 다 보고, ssh that-host 로 user/IP/port 안 치고 연결되는지 확인. 이 한 습관이 평생 매일 몇 분 절약해.

Progress

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

댓글 0

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

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