본문 바로가기
반응형
Programming/Linux

iTerms2 ssh session 공유를 통한 자동 로그인

by JAMINS 2022. 10. 5.

Mac 환경에서 iTerms 터미널 ssh 접속후 새 창을 띄워서 다시 작업해야하는 경우 다시 로그인해야하는 불편함이 있다.

창을 n개로 분할하여 동시에 command를 입력하는 경우에는 더더욱 로그인 과정이 번거로운데 ssh session 공유를 통해 자동 로그인을 해보자.

  • iTerms2 메뉴 > Profiles > Open Profiles 창에서 Edit Profile 선택
  • 좌측하단 + 버튼으로 profile 추가
  • Command > command 선택 후 ssh -A -p 22 {접속할 connection 정보} 를 입력
  • Working Directory > Reuse previous session's directory

Mac 홈디렉토리에서 .ssh 설정

  • cd .ssh
  • vim config
host *
ControlPersist yes
ControlMaster auto
ControlPath ~/.ssh/master-%r@%h:%p
ServerAliveInterval 60

저장 후 ssh 로그인한 다음 창을 분리해서 ssh 접속해보면 추가 인증없이 잘 로그인 되는 것을 확인!

댓글