hi , i have 2 diiferent vps with 2 different ip and domain , i made some ssh accounts so peoples can login and use ssh to bypass my country internet filtering . bcuz of some reason i need to use 2 vps , but i wanna make accounts only on vps1 and the vps2 get forwarded and login to vps 1 accounts : for example :
on my vps 1 , i made some accounts so users can login with this : vps1 domain or ip ssh port username password
and use free internet .
but bcuz of some reasons , i need to give some other peoples my Vps 2 domain and ip , but i dont wanna make accounts again on vps 2 .
so what i want is when someone use : vps 2 domain or ip ssh port ( same as vps 1 ) username password
get forwarded to Vps 1 that i made ssh username and password on it and login to use free internet . is it possible to do such a thing only with open ssh ? is it possible to have vps 1 with ssh username and passes and vps2 without any user and only get forwarded to vps1 and use that username and pass data to get login to vps 1 ?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Heya @driftinglightcyanurchin,
You can achieve this by using SSH port forwarding between your two VPS and a simple systemd service. You’ll need to configure VPS2 to forward incoming SSH connections to VPS1.
In such cases, I’ve used the
socat
utility. Socat (for SOcket CAT) establishes two bidirectional byte streams and transfers data between them. Data channels may be files, pipes, devices (terminal or modem, etc.), or sockets (Unix, IPv4, IPv6, raw, UDP, TCP, SSL)To install it, run:
Configure VPS2 to forward incoming SSH connections to VPS1:
Create a new systemd service file at
/etc/systemd/system/ssh-forward.service
:Don’t forget to replace
vps1.example.com
with the domain or IP address of VPS1. Enable and start the SSH forwarding service:Now, when someone connects to VPS2 using the SSH port (22 by default), their connection will be forwarded to VPS1. They can then authenticate using the username and password created on VPS1.
Please note that this setup assumes that VPS2 doesn’t need to accept SSH connections for its own management. If you need to manage VPS2 via SSH, you should configure a different port for the forwarding service.
thanks man, i needed to forward 2 more ports 443 , 13081 , i made the same file with ssh-dorward2 , 3 and now ports 2255 for ssh , and 13081 works perfect , but on port 443 bcuz its for v2ray and has an TLS option it wont work , i think its bcuz on this config i put my vps1 domain cert , key . i think thats why when someone use the connection that has vps2 domain cant work well with this 443 port forward , how can i fix this problem ?