ssh tunnel
One way to create a "VPN" type connection using SSH is by combining the dynamic port forwarding method with a web browser that supports SOCKS proxies.
By using the dynamic port forwarding command, you can create a SOCKS proxy on your local machine that tunnels traffic through the remote server.
Then, you can configure your web browser to use the SOCKS proxy on the local port you specified in the command.
For example, if you create a SOCKS proxy on local port 1080 using the command
ssh -D 1080 user@remote-server
Keep in mind that while this method can provide some level of privacy and security, it is not a true VPN and may not protect all of your internet activity. Additionally, using SSH for web browsing can be slower than traditional VPN services, so it may not be the best option for high-bandwidth activities.
There are two different ways of tunneling traffic with SSH:
ssh -L <local-port>:localhost:<remote-port> <remote-server>
ssh -D <local-port> <remote-server>
The configuration setting required for local port forwarding is GatewayPorts yes in the sshd configuration file on the remote server.
The configuration setting required for dynamic port forwarding is AllowTcpForwarding yes in the sshd configuration file on the remote server.
To activate GatewayPorts or AllowTcpForwarding, you need to modify the sshd_config file located in the /etc/ssh/ directory on the remote server.
It is recommended to only enable these settings if you trust the remote server and its users, as they can potentially pose security risks.