Skip to content

Instantly share code, notes, and snippets.

@FaridAghili
Created February 16, 2023 00:53
Show Gist options
  • Save FaridAghili/ffe3b6c5e85957958134321ea6e3c66c to your computer and use it in GitHub Desktop.
Save FaridAghili/ffe3b6c5e85957958134321ea6e3c66c to your computer and use it in GitHub Desktop.
Configuring a SSH tunnel

Updates

apt update
apt upgrade -y
apt autoremove -y
apt autoclean -y

Enable BBR

nano /etc/sysctl.conf
Add following lines to the end of file, save and exit:
net.core.default_qdisc=fq
net.ipv4.tcp_congestion_control=bbr
Run following command:
sysctl -p

Firewall

ufw allow 22/tcp
ufw allow 443/tcp
ufw enable

Change SSH port

nano /etc/ssh/sshd_config

Find and change #Port 22 to Port 443, save and exit.

Restart SSH service
systemctl restart sshd
exit

SSH to server

ssh -p 443 {ip_address}

Then

ufw delete allow 22/tcp

Add user

adduser username --shell=/bin/false

Delete user

deluser user
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment