250404 TIL #628 mac에서 SSH 접속

김춘복·2025년 4월 4일
0

TIL : Today I Learned

목록 보기
632/635

Today I Learned

맥에서 ssh를 접속할 때 윈도우랑은 거의 비슷하긴 하지만 살짝 달라서 새로 정리해봤다.


참고 사이트 : mojostock

mac에서 SSH 접속

  1. PEM키 저장 위치
    /Users/[사용자명]/.ssh/
  • .ssh는 finder에서 기본적으로 안보이기 때문에 cmd+shift+.으로 숨겨진 파일을 모두 보면 보인다.
  • 터미널에서 현재 위치에서 finder를 열어서 보려면
    $ open .을 하면 된다.
  1. config 수정
cd ~/.ssh
vim config
  • 아래의 형식처럼 등록
Host 서버명칭
	HostName [ip주소]
    User [계정명]
    Port [포트 번호]
    IdentityFile ~/.ssh/키이름.pem
    
Host front-server
    HostName 111.111.111.111
    User ubuntu
    Port 1111
    
Host back-server
    HostName 222.222.222.222
    User root
    Port 2222
    IdentityFile ~/.ssh/second_server.pem
  1. 서버 접속
  • in 터미널
ssh front-server
ssh back-server
  • in vscode
    Remote-SSH Extension 설치
    cmd+shift+p 눌러서 remote-SSH: Connect to host... 선택
profile
Full-Stack Dev / Data Engineer

0개의 댓글

Powered by GraphCDN, the GraphQL CDN