<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/ssh-port-22-custom-ports-port-forwarding-security-and-production-ssh-hardening-bpywlngeu" -->

---
title: SSH Port 22: Custom Ports, Port Forwarding Security, and...
description: A deep-dive into production SSH security covering why changing the default port 22 mostly just reduces log noise rather than improving security, the real...
canonical: https://daily.dev/posts/ssh-port-22-custom-ports-port-forwarding-security-and-production-ssh-hardening-bpywlngeu
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: SSH Port 22: Custom Ports, Port Forwarding Security, and Production SSH Hardening | daily.dev
og:description: A deep-dive into production SSH security covering why changing the default port 22 mostly just reduces log noise rather than improving security, the real...
og:url: https://daily.dev/posts/ssh-port-22-custom-ports-port-forwarding-security-and-production-ssh-hardening-bpywlngeu
og:image: https://api.daily.dev/og/posts/bPYWLnGEu.png
og:image:alt: SSH Port 22: Custom Ports, Port Forwarding Security, and Production SSH Hardening
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# SSH Port 22: Custom Ports, Port Forwarding Security, and Production SSH Hardening

**[Teleport](https://daily.dev/sources/teleport)** · 16 min read · 0 upvotes · 0 comments

## Summary

A deep-dive into production SSH security covering why changing the default port 22 mostly just reduces log noise rather than improving security, the real attack vectors in local/remote/dynamic port forwarding, cryptographic hardening of KexAlgorithms/ciphers/MACs, rate limiting via PerSourcePenalties and nftables, and the shift from authorized_keys to certificate authorities. It closes by arguing hardened SSH still relies on static credentials and configuration, whereas certificate-based access (as offered by Teleport) evaluates identity at connection time.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://goteleport.com/blog/ssh-port-22>

## Questions this post answers

### Does changing the SSH listening port from 22 actually make a server more secure?

Changing the port mainly reduces log noise, not real attack surface. Port 22 only controls where the TCP handshake lands; it does not affect authentication method, negotiated ciphers, or post-connection authorization. A targeted attacker running a port scan will find SSH regardless. A server on a custom port with weak ciphers and password authentication is less secure than one on port 22 with strict algorithm restrictions and certificate-based auth.

_Track real SSH hardening guidance beyond the port-22 myth by following security deep dives on daily.dev._

### What does OpenSSH's DisableForwarding directive do and are there version issues with it?

DisableForwarding yes, introduced in OpenSSH 7.3, disables all SSH forwarding types (local, remote, dynamic, X11, agent) with a single directive. However, OpenSSH versions 7.4 through 9.9 had a logic error where certain forwarding modes weren't consistently disabled in all cases; this was fixed in OpenSSH 9.9p2. Explicitly disabling X11, agent, and TCP forwarding alongside the directive remains a safer, defensible practice across mixed environments.

_Developers hardening sshd configs can keep up with OpenSSH version quirks like this on daily.dev._

### What is PerSourcePenalties in OpenSSH and what problem does it solve?

PerSourcePenalties is an OpenSSH mechanism, requiring OpenSSH 9.9p2 or later, that automatically penalizes source addresses exhibiting abusive pre-authentication behavior. It is particularly relevant to CVE-2025-26466, where repeated pre-authentication interactions could consume excessive server resources. The directive must be configured explicitly since it is not assumed active by default, and it works alongside network-layer tools like nftables for kernel-level rate limiting.

_Engineers defending sshd against brute-force traffic can track CVE and mitigation details on daily.dev._

## Similar posts on daily.dev

- [Hardening SSH: Fail2Ban, Nftables & Cloud Firewalls](https://daily.dev/posts/hardening-ssh-fail2ban-nftables-cloud-firewalls-btns6dfx7) · DigitalOcean Community · 1 upvotes · 0 comments

---

Tags: [#cryptography](https://daily.dev/tags/cryptography), [#ssh](https://daily.dev/tags/ssh)

[View this post on daily.dev](https://daily.dev/posts/ssh-port-22-custom-ports-port-forwarding-security-and-production-ssh-hardening-bpywlngeu)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"SSH Port 22: Custom Ports, Port Forwarding Security, and Production SSH Hardening","url":"https://daily.dev/posts/ssh-port-22-custom-ports-port-forwarding-security-and-production-ssh-hardening-bpywlngeu","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/ssh-port-22-custom-ports-port-forwarding-security-and-production-ssh-hardening-bpywlngeu"},"datePublished":"2026-08-23T12:21:48.021Z","dateModified":"2026-08-23T12:41:29.669Z","description":"A deep-dive into production SSH security covering why changing the default port 22 mostly just reduces log noise rather than improving security, the real...","image":"https://media.daily.dev/image/upload/s--P4t4XyoV--/f_auto/v1722860399/public/Placeholder%2001","thumbnailUrl":"https://media.daily.dev/image/upload/s--P4t4XyoV--/f_auto/v1722860399/public/Placeholder%2001","isAccessibleForFree":true,"articleSection":"Teleport","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Teleport","logo":"https://media.daily.dev/image/upload/s--Dw-Bbw6O--/c_limit,w_256/f_auto,q_auto/v1787487494/logos/teleport?_a=BAMAMicg0","url":"https://daily.dev/sources/teleport"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/ssh-port-22-custom-ports-port-forwarding-security-and-production-ssh-hardening-bpywlngeu","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"cryptography,ssh","timeRequired":"PT16M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Teleport","item":"https://daily.dev/sources/teleport"},{"@type":"ListItem","position":3,"name":"SSH Port 22: Custom Ports, Port Forwarding Security, and Production SSH Hardening"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/ssh-port-22-custom-ports-port-forwarding-security-and-production-ssh-hardening-bpywlngeu#faq","mainEntity":[{"@type":"Question","name":"Does changing the SSH listening port from 22 actually make a server more secure?","acceptedAnswer":{"@type":"Answer","text":"Changing the port mainly reduces log noise, not real attack surface. Port 22 only controls where the TCP handshake lands; it does not affect authentication method, negotiated ciphers, or post-connection authorization. A targeted attacker running a port scan will find SSH regardless. A server on a custom port with weak ciphers and password authentication is less secure than one on port 22 with strict algorithm restrictions and certificate-based auth. Track real SSH hardening guidance beyond the port-22 myth by following security deep dives on daily.dev."}},{"@type":"Question","name":"What does OpenSSH's DisableForwarding directive do and are there version issues with it?","acceptedAnswer":{"@type":"Answer","text":"DisableForwarding yes, introduced in OpenSSH 7.3, disables all SSH forwarding types (local, remote, dynamic, X11, agent) with a single directive. However, OpenSSH versions 7.4 through 9.9 had a logic error where certain forwarding modes weren't consistently disabled in all cases; this was fixed in OpenSSH 9.9p2. Explicitly disabling X11, agent, and TCP forwarding alongside the directive remains a safer, defensible practice across mixed environments. Developers hardening sshd configs can keep up with OpenSSH version quirks like this on daily.dev."}},{"@type":"Question","name":"What is PerSourcePenalties in OpenSSH and what problem does it solve?","acceptedAnswer":{"@type":"Answer","text":"PerSourcePenalties is an OpenSSH mechanism, requiring OpenSSH 9.9p2 or later, that automatically penalizes source addresses exhibiting abusive pre-authentication behavior. It is particularly relevant to CVE-2025-26466, where repeated pre-authentication interactions could consume excessive server resources. The directive must be configured explicitly since it is not assumed active by default, and it works alongside network-layer tools like nftables for kernel-level rate limiting. Engineers defending sshd against brute-force traffic can track CVE and mitigation details on daily.dev."}}]}
```

