2015년 11월 23일 월요일

SSH ProxyCommand [Eng]


There are some case to connect to the server by using bastion or another server
,because of security issue or etc.
In this case, you can use the macro of some programs like Teraterm,
however, you can also use SSH ProxyCommand.


DeskTop ----- middleServer ----- TargetServer


$ vi ~/.ssh/config

Host TargetHostName
     Hostname TargetServerHost
     Port port
     User user
     ProxyCommand ssh -pPortNumber middleUser@hostIp nc %h %p
     IdentityFile keyFilePath


TargetHostName : Host Name that is used when connecting from DeskTop to TargetServer
TargetServerHost : TargetServer's IP or HostName that is used when connecting from middleServer to TargetServer
port : port that is used when connecting from middleServer to TargetServer
user : user name that is used when connecting from middleServer to TargetServer
PortNumber : port that is used when connecting from DeskTop to middleServer
middleUser : user name that is used when connecting from DeskTop to middleServer
hostIp : IP or HostName that is used when connecting from DeskTop to middleServer
keyFilePath : ssh key file's path that can be used for middleServer, TargetServer both

After saving the config file as above,
you can connect to the server that you set by using the command as below.


$ ssh TargetHostName

댓글 없음 :

댓글 쓰기