728x90
반응형
~/.ssh/config 에 설정(없으며 만든다.)
Host forward
HostName 123.456.789.12
User ec2-user
IdentityFile ~/identity/pemFileName.pem
LocalForward localhost:1234 amazonaws.com:3306
Host aws
HostName 234.567.890.12
User userName
IdentityFile ~/identity/pemFileName.pem
- Host : 나중에 ssh명령어 뒤에 넣을 이름
- HostName : IP
- IdentityFile : pemfile경로
- LocalForward {localhost:로컬에서사용할포트} {원격지IP:포트}
$ ssh forward
$ ssh aws
ssh명령어로 치면 바로 연결된다.
만약 저렇게 설정안해놓았다면 아래와 같이 길게 쳐야한다.
$ ssh -i ~/identity/pemFileName.pem ec2-user@123.456.789.12 -L 1234:amazonaws.com:3306
LocalForwad 설정 방법이 ssh 명령어를 칠때와 config파일 설정 부분이 달라 고생했다.
참고사이트
https://linux.die.net/man/5/ssh_config
ssh_config(5): OpenSSH SSH client config files - Linux man page
ssh_config(5) - Linux man page Name ssh_config - OpenSSH SSH client configuration files Synopsis ~/.ssh/config /etc/ssh/ssh_config Description ssh(1) obtains configuration data from the following sources in the following order: 1. command-line options 2. u
linux.die.net
728x90
반응형