To remotely access a server using a proxy service like ngrok for improving connection speed and upgrading the direct connection, follow the steps below:
- Install ngrok on your local machine:
curl -olngrok.zip https://dl.ngrok.com/ngrok-stable-OSX.zip
unzip lngrok.zip
sudo mv ngrok /usr/local/bin/
- Start the SSH tunnel using ngrok:
ngrok tcp 22
-
Note down the public URL provided by ngrok. It will look something like this:
https://<unique-id>.ngrok.io -
On your server, edit the SSH configuration file (
/etc/ssh/sshd_config) and set the following options:
# Allow remote access only from the ngrok-provided IP address
AllowHosts <unique-ip-address>
# Increase the maximum number of concurrent connections
MaxStartups 100
MaxSessions 100
Replace <unique-ip-address> with the IP address shown in the ngrok output.
- Restart the SSH service:
sudo systemctl restart ssh
- Now, you can use the public URL provided by ngrok to connect to your server via SSH.
References:
- Ngrok documentation: https://ngrok.com/docs
- Configuring SSH server: https://www.digitalocean.com/community/tutorials/how-to-secure-ssh-access-to-your-ubuntu-20-04-server
This guide will help you establish a remote SSH connection using ngrok and improve your connection speed by upgrading the direct connection.