我想通过Dedipath的VPS代理我的家庭SSH服务器,但是我不知道它是如何工作的。因为我已经和许多tcp代理一起尝试过了,但是它们没有工作。
我的VPS有Debian 10和我的主服务器。
发布于 2022-07-22 13:40:14
如果我假设您的家庭服务器位于NAT之后,而您的VPS具有公共internet IP,则可以使用ssh远程隧道选项:
useradd -m tunneltovps
sudo -u tunneltovps -i
ssh-keygen -t ed25519
cat ~/.ssh/id_ed25519.pub
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... tunneltovps@myhome-server
* on your VPS server, create a dedicated user for the tunnel with home-server, and copy the public key to `~/.ssh/authorized_keys`:
```shell用户添加-m myhomeserver
数独-u myhomeserver -i
mkdir .ssh
AAAAC3NzaC1lZDI1NTE5AAAA 25519.tunneltovps@myhome-服务器>> ~/..ssh/授权密钥
复制
- on the home-server, test the connexion:
```javascript数多-u隧道-i
ssh -R 1234:localhost:22 my-vps-server
复制
Now, on your VPS the port 1234 should be listening (on localhost) and tunneling to your ssh server on myhome-server
you can test to connect to your home-server from any machine connected to internet by using the VPS as a jumphost:
```javascriptssh -J my- -p服务器-p 1234本地主机
复制
Alternatively, if you want to expose publicly the ssh server of my-home-server, you could use this command to create the tunnel on the home-server:
```javascriptssh -R 0.0.0.0:1234:localhost:22 my server
复制
Now your home-server could be reachable directly (without jumphost) with:
```javascriptssh -p 1234 my-vps-server
https://serverfault.com/questions/1106299
复制相似问题