Skip to content

Instantly share code, notes, and snippets.

@wongyouth
Last active December 25, 2017 06:04
Show Gist options
  • Select an option

  • Save wongyouth/7268c5cf387e569dd129ff8a778bcb1b to your computer and use it in GitHub Desktop.

Select an option

Save wongyouth/7268c5cf387e569dd129ff8a778bcb1b to your computer and use it in GitHub Desktop.
SSH tunnel 在家链接公司Mac电脑
# 1. 公司电脑打开 远程登录 功能
# 2. 公司电脑连接到 服务器,并监听服务器本地 3456 端口
# 当有链接到服务器 3456 时,tunnel 回公司电脑的 22 端口,及 sshd 服务
ssh -NR 3456:localhost:22 server
# 3. 在家链接公司服务器 3456 端口
# 假设服务器登录时不需要输入密码。
# 提示输入密码时,输入家里的电脑密码。
ssh -t server ssh -p 3456 user@localhost
`user` 是公司服务器的用户名
# 3‘. 或者打开本地端口监听
ssh -L 2222:localhost:3456 server
# 3.1' 链接公司电脑
ssh -p 2222 localhost
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment