- Install ssh and define user
# Update system and install SSH server
sudo apt update
sudo apt install openssh-server
# Check SSH service status
sudo systemctl status ssh
# Create new user
sudo adduser alex
# During this step you'll be prompted to:
# - Set and confirm password
# - Fill in optional user information (you can press Enter to skip)
# Add user to sudo group
sudo usermod -aG sudo alex
# Edit SSH configuration to allow password authentication
sudo nano /etc/ssh/sshd_config
# Make sure these lines are set:
# PasswordAuthentication yes
# PermitRootLogin yes
# Restart SSH service
sudo systemctl restart sshd
- Install ngrok
sudo snap install ngrok
- Run ngrok tcp server Generate your token on the ngrok dashboard
ngrok authtoken <YOUR_AUTH_TOKEN>
ngrok tcp 22
You should see something like
Session Status online
Account Alex (Plan: Free)
Version 3.20.0
Region Europe (eu)
Latency 64ms
Web Interface http://127.0.0.1:4040
Forwarding tcp://0.tcp.eu.ngrok.io:14712 -> localhost:22
Connections ttl opn rt1 rt5 p50 p90
2 0 0.00 0.00 8.06 9.72
- To connect from remote machine
Copy the Forwarding value and run:
ssh [email protected] -p 14712
You neet to input the password that you have defined for the user.