2007年10月16日星期二

SSH tips - configuring ~/.ssh/config to make your ssh command shorter

  有时候在家工作, 而我平时在办公室的工作环境是一台服务器, 所以在家时就需要以公司网关服务器做一些端口映射到我工作的服务器上. 但是经常敲一大串ssh command的确很烦恼, 所以就尝试着配置一下~/.ssh/config文件, 示例如下

Host gateway.com
Hostname gateway.company.com
User jacky
#forwarding of the authentication agent connection
ForwardAgent yes
GatewayPorts yes
#local ports forwarding for working servers
LocalForward localhost:9079 forge:9079
LocalForward localhost:9060 forge:9060
LocalForward localhost:9078 forge:9078
LocalForward localhost:9099 forge:9099
LocalForward localhost:9090 forge:9090
# local ports forwarding for vnc server
LocalForward localhost:5900 jacky:5900


没有评论: