VPS1Euro Dashboard Wiki

Complete client guide: infrastructure, services, account and support.

FR EN

Change SSH port and secure access

Reduce intrusion attempts by changing the default SSH port.

What this tutorial does

The tutorial "Change SSH port and secure access" helps you achieve this goal:

Reduce intrusion attempts by changing the default SSH port.

← Back to tutorials
1 profiles 11 steps 7 commands ~15 min

Debian/Ubuntu

  1. Edit SSH configuration: nano /etc/ssh/sshd_config
  2. Edit: Port 2222 (choose a port between 1024 and 65535)
  3. Disable direct root login: PermitRootLogin no
  4. Disable password authentication (if SSH key configured): PasswordAuthentication no
  5. Limit allowed users: AllowUsers deploy
  6. Allow new port in iptables: iptables -A INPUT -p tcp --dport 2222 -j ACCEPT
  7. Remove old SSH port from rules: iptables -D INPUT -p tcp --dport 22 -j ACCEPT
  8. Backup iptables: netfilter-persistent save
  9. Restart SSH: systemctl restart sshd
  10. IMPORTANT: Test the connection with the new port BEFORE closing the current session.
  11. Connecting with the new port: ssh -p 2222 deploy@IP