os/Linux

ssh proxy

C/H 2016. 12. 26. 08:30

#1. Pseudo Terminal
ssh -tt server1 ssh server2

#2. ProxyCommand
ssh -o ProxyCommand="ssh -W %h:%p server1" server2

#3. ~/.ssh/config
Host server1
    HostNmae domain.com
    Port 22
    User Username
Host s2 
    HostName server2 
    User user2 
    IdentityFile ~/.ssh/server2_id_rsa
    ProxyCommand ssh -W server2:22 server1
    #ProxyCommand ssh -xaqW%h:%p server1

chmod 600 ~/.ssh/config
ssh s2
ssh root@s2

#4. netcat 을 이용한 ProxyCommand
ssh -o ProxyCommand="ssh server1 nc server2 22" server2
$ ssh -tt root@s1 ssh -tt root@s2 -p2220 ssh root@s3
root@s1's password:
root@s2's password:
root@s3's password:
$ exit
logout
Connection to paranoid closed.
Killed by signal 1.
$


반응형

'os > Linux' 카테고리의 다른 글

curl -kvLS https://google.co.kr 에러  (0) 2017.02.20
ssh 자동연결  (0) 2017.02.10
CentOS yum epel 저장소 에러  (0) 2016.06.03
CentOs "No package htop available."  (0) 2016.01.04
seige 부하테스트 및 모니터링  (0) 2015.12.29