{"id":3048,"date":"2026-11-02T10:00:00","date_gmt":"2026-11-02T07:00:00","guid":{"rendered":"https:\/\/narhost.com\/destek\/?p=3048"},"modified":"2026-11-02T20:57:27","modified_gmt":"2026-11-02T17:57:27","slug":"ubuntu-2404-ssh-portu-degistirme","status":"publish","type":"post","link":"https:\/\/narhost.com\/destek\/ubuntu-2404-ssh-portu-degistirme\/","title":{"rendered":"Ubuntu 24.04&#8217;te SSH Portu De\u011fi\u015fmiyor, ssh.socket Nas\u0131l Ayarlan\u0131r"},"content":{"rendered":"<p class=\"kb-dogrulama\">Son g\u00f6zden ge\u00e7irme: Kas\u0131m 2026 \u00b7 Ubuntu 24.04 openssh-server paket belgesine (README.Debian) g\u00f6re<\/p>\n<div id=\"hizli-cozum\" class=\"ai-box ai-box--cozum\">\n<p class=\"ai-box-title\">H\u0131zl\u0131 \u00e7\u00f6z\u00fcm<\/p>\n<p><strong>Ubuntu 24.04 SSH portu de\u011fi\u015ftirme<\/strong> i\u015fleminde <code>sshd_config<\/code> dosyas\u0131ndaki <code>Port<\/code> sat\u0131r\u0131 tek ba\u015f\u0131na yetmez; SSH bu s\u00fcr\u00fcmde <code>ssh.socket<\/code> ile ba\u015flat\u0131l\u0131r ve dinlenen port, systemd&#8217;nin yeniden \u00fcretmesi gereken soket ayar\u0131ndan gelir:<\/p>\n<ol>\n<li>Yeni portu g\u00fcvenlik duvar\u0131nda a\u00e7\u0131n: <code>sudo ufw allow 2222\/tcp<\/code>.<\/li>\n<li><code>\/etc\/ssh\/sshd_config.d\/<\/code> alt\u0131nda <code>Port 2222<\/code> sat\u0131r\u0131 olan bir dosya olu\u015fturun.<\/li>\n<li><code>sudo systemctl daemon-reload<\/code> ve <code>sudo systemctl restart ssh.socket<\/code> komutlar\u0131n\u0131 \u00e7al\u0131\u015ft\u0131r\u0131n.<\/li>\n<li><code>sudo ss -tlnp | grep ssh<\/code> ile yeni portu g\u00f6r\u00fcn, ikinci bir oturumla ba\u011flanmay\u0131 deneyin.<\/li>\n<\/ol>\n<\/div>\n<table class=\"kb-uyg\">\n<tr>\n<th>Panel<\/th>\n<td>SSH (komut sat\u0131r\u0131)<\/td>\n<\/tr>\n<tr>\n<th>Sistem<\/th>\n<td>Ubuntu 24.04 LTS (openssh-server, systemd soket etkinle\u015ftirme)<\/td>\n<\/tr>\n<tr>\n<th>Yetki<\/th>\n<td>root ya da sudo<\/td>\n<\/tr>\n<tr>\n<th>Narhost \u00fcr\u00fcn\u00fc<\/th>\n<td><a href=\"https:\/\/narhost.com\/vps-sunucu\" title=\"Narhost VPS Sunucu paketleri\">VPS Sunucu<\/a>, VDS Sunucu<\/td>\n<\/tr>\n<\/table>\n<div class=\"kb-once\">\n<p class=\"label\">Ba\u015flamadan \u00f6nce<\/p>\n<ul>\n<li>Mevcut SSH oturumunuzu i\u015flem bitene kadar kapatmay\u0131n; yeni portu ayr\u0131 bir pencereden deneyin.<\/li>\n<li>Sunucuya taray\u0131c\u0131 terminali (konsol) ile eri\u015febildi\u011finizi bilin; port yanl\u0131\u015f ayarlan\u0131rsa oradan d\u00fczeltirsiniz.<\/li>\n<li>1024 ile 65535 aras\u0131nda, ba\u015fka bir hizmetin kullanmad\u0131\u011f\u0131 bir port se\u00e7in. \u00d6rnekte 2222 kullan\u0131l\u0131yor.<\/li>\n<\/ul>\n<\/div>\n<h2>Ubuntu 24.04&#8217;te SSH portu neden de\u011fi\u015fmiyor<\/h2>\n<p>Eski Ubuntu s\u00fcr\u00fcmlerinde <code>sshd_config<\/code> i\u00e7indeki <code>Port<\/code> de\u011ferini de\u011fi\u015ftirip <code>systemctl restart ssh<\/code> \u00e7al\u0131\u015ft\u0131rmak yeterliydi. Ubuntu 22.10&#8217;dan beri <code>openssh-server<\/code> varsay\u0131lan olarak systemd soket etkinle\u015ftirmesiyle \u00e7al\u0131\u015f\u0131r: 22 numaral\u0131 portu SSH hizmeti de\u011fil <code>ssh.socket<\/code> birimi dinler ve ba\u011flant\u0131 gelince hizmeti ba\u015flat\u0131r. Bu y\u00fczden yaln\u0131z hizmeti yeniden ba\u015flatmak dinlenen portu de\u011fi\u015ftirmez; sunucu 22&#8217;yi dinlemeye devam eder.<\/p>\n<p>Ubuntu 24.04&#8217;te paket bu sorunu bir \u00fcrete\u00e7le \u00e7\u00f6zer. <a href=\"https:\/\/git.launchpad.net\/ubuntu\/+source\/openssh\/plain\/debian\/README.Debian?h=ubuntu\/noble\" title=\"Ubuntu openssh paketi README.Debian \u2014 soket etkinle\u015ftirme ve sshd-socket-generator\" target=\"_blank\" rel=\"noopener\">Paketin README.Debian belgesine<\/a> g\u00f6re <code>sshd-socket-generator<\/code>, SSH yap\u0131land\u0131rmas\u0131n\u0131 okur ve varsay\u0131lan d\u0131\u015f\u0131nda bir <code>Port<\/code> ya da <code>ListenAddress<\/code> bulursa <code>ssh.socket<\/code> i\u00e7in gerekli ayar\u0131 \u00fcretir. \u00dcretecin \u00e7al\u0131\u015fmas\u0131 i\u00e7in <code>daemon-reload<\/code>, yeni ayar\u0131n uygulanmas\u0131 i\u00e7in de soketin yeniden ba\u015flat\u0131lmas\u0131 gerekir.<\/p>\n<figure class=\"nh-sema\"><img src=\"https:\/\/narhost.com\/destek\/wp-content\/uploads\/2026\/11\/ubuntu-2404-ssh-portu-degistirme-sema-narhost.webp\" alt=\"ubuntu 24.04 ssh portu de\u011fi\u015ftirme \u015femas\u0131 \u2014 g\u00fcvenlik duvar\u0131, sshd_config.d, daemon-reload ve ssh.socket\" width=\"1200\" height=\"500\" loading=\"lazy\" decoding=\"async\"><figcaption>Port sat\u0131r\u0131 \u00fcrete\u00e7 taraf\u0131ndan soket ayar\u0131na \u00e7evrilir; hizmeti de\u011fil soketi yeniden ba\u015flat\u0131n.<\/figcaption><\/figure>\n<h2>Ad\u0131m ad\u0131m Ubuntu 24.04 SSH portu de\u011fi\u015ftirme<\/h2>\n<ol class=\"kb-adimlar\">\n<li><strong>Yeni portu g\u00fcvenlik duvar\u0131nda a\u00e7\u0131n.<\/strong> UFW etkinse bunu port de\u011fi\u015fikli\u011finden \u00f6nce yap\u0131n, yoksa yeni porta ba\u011flanamazs\u0131n\u0131z.\n<pre><code class=\"language-bash\">sudo ufw allow 2222\/tcp\nsudo ufw status<\/code><\/pre>\n<p class=\"kb-cikti\">Beklenen sonu\u00e7: kural listesinde <code>2222\/tcp ALLOW<\/code> sat\u0131r\u0131 g\u00f6r\u00fcn\u00fcr.<\/p>\n<\/li>\n<li><strong>Portu bir ek yap\u0131land\u0131rma dosyas\u0131na yaz\u0131n.<\/strong> Ana dosyay\u0131 de\u011fi\u015ftirmek yerine <code>sshd_config.d<\/code> klas\u00f6r\u00fcn\u00fc kullanmak, paket g\u00fcncellemelerinde \u00e7ak\u0131\u015fmay\u0131 \u00f6nler.\n<pre><code class=\"language-bash\">echo \"Port 2222\" | sudo tee \/etc\/ssh\/sshd_config.d\/10-port.conf\nsudo sshd -t<\/code><\/pre>\n<p class=\"kb-cikti\">Beklenen sonu\u00e7: <code>sshd -t<\/code> hi\u00e7bir \u00e7\u0131kt\u0131 vermez. Bir hata sat\u0131r\u0131 g\u00f6r\u00fcrseniz devam etmeden dosyay\u0131 d\u00fczeltin.<\/p>\n<\/li>\n<li><strong>Soket ayar\u0131n\u0131 yeniden \u00fcretip uygulay\u0131n.<\/strong>\n<pre><code class=\"language-bash\">sudo systemctl daemon-reload\nsudo systemctl restart ssh.socket<\/code><\/pre>\n<\/li>\n<li><strong>Dinlenen portu kontrol edin.<\/strong>\n<pre><code class=\"language-bash\">sudo ss -tlnp | grep -E ':22 |:2222 '<\/code><\/pre>\n<p class=\"kb-cikti\">Beklenen sonu\u00e7: dinleme sat\u0131rlar\u0131nda <code>:2222<\/code> g\u00f6r\u00fcn\u00fcr, <code>:22<\/code> g\u00f6r\u00fcnmez. Sat\u0131rlar\u0131n sonunda s\u00fcre\u00e7 ad\u0131 olarak <code>systemd<\/code> g\u00f6r\u00fcnmesi normaldir; portu soket birimi tutar.<\/p>\n<\/li>\n<li><strong>Yeni portla ikinci bir oturum a\u00e7\u0131n.<\/strong> Kendi bilgisayar\u0131n\u0131zdan:\n<pre><code class=\"language-bash\">ssh -p 2222 kullanici@203.0.113.10<\/code><\/pre>\n<p class=\"kb-cikti\">Ba\u011flant\u0131 a\u00e7\u0131ld\u0131ysa eski oturumu kapatabilir ve UFW&#8217;deki 22 kural\u0131n\u0131 <code>sudo ufw delete allow 22\/tcp<\/code> ile kald\u0131rabilirsiniz.<\/p>\n<\/li>\n<\/ol>\n<div class=\"warn-box\">\n<p class=\"label\">Dikkat<\/p>\n<p>Port 22&#8217;yi g\u00fcvenlik duvar\u0131ndan yeni porta ba\u011fland\u0131\u011f\u0131n\u0131z\u0131 g\u00f6rmeden kald\u0131rmay\u0131n. Ba\u011flant\u0131 kurulamazsa taray\u0131c\u0131 terminalinden girip <code>10-port.conf<\/code> dosyas\u0131n\u0131 silin, ard\u0131ndan <code>daemon-reload<\/code> ve <code>restart ssh.socket<\/code> komutlar\u0131n\u0131 tekrarlay\u0131n; SSH 22&#8217;ye d\u00f6ner.<\/p>\n<\/div>\n<h2>Soket etkinle\u015ftirmesini kapatmak isterseniz<\/h2>\n<p>Baz\u0131 y\u00f6netim ara\u00e7lar\u0131 ve eski betikler SSH&#8217;\u0131n klasik <code>ssh.service<\/code> olarak \u00e7al\u0131\u015fmas\u0131n\u0131 bekler. Paket belgesi, \u00fcreteci maskeleyip hizmete d\u00f6nmeyi \u015f\u00f6yle tarif eder:<\/p>\n<pre><code class=\"language-bash\">sudo mkdir -p \/etc\/systemd\/system-generators\/\nsudo ln -s \/dev\/null \/etc\/systemd\/system-generators\/sshd-socket-generator\nsudo systemctl daemon-reload\nsudo systemctl disable --now ssh.socket\nsudo systemctl enable --now ssh.service<\/code><\/pre>\n<p>Bu durumda <code>sshd_config<\/code> i\u00e7indeki <code>Port<\/code> de\u011feri do\u011frudan SSH hizmeti taraf\u0131ndan okunur ve sonraki port de\u011fi\u015fikliklerinde <code>sudo systemctl restart ssh<\/code> yeterli olur.<\/p>\n<h2>Do\u011frulama<\/h2>\n<div class=\"success-box\">\n<p class=\"label\">Sonu\u00e7<\/p>\n<p><code>ss -tlnp<\/code> \u00e7\u0131kt\u0131s\u0131nda yaln\u0131z yeni port g\u00f6r\u00fcn\u00fcyor ve <code>ssh -p 2222<\/code> ile ba\u011flanabiliyorsan\u0131z Ubuntu 24.04 SSH portu de\u011fi\u015ftirme i\u015flemi tamamlanm\u0131\u015ft\u0131r. Sunucu yeniden ba\u015flat\u0131ld\u0131ktan sonra da ayn\u0131 komutla portu bir kez daha kontrol edin.<\/p>\n<\/div>\n<h2>H\u00e2l\u00e2 \u00e7\u00f6z\u00fclmediyse<\/h2>\n<ul>\n<li><strong>Sunucu hem 22&#8217;yi hem yeni portu dinliyor.<\/strong><code>\/etc\/systemd\/system\/ssh.socket.d\/<\/code> alt\u0131nda elle eklenmi\u015f eski bir <code>ListenStream<\/code> dosyas\u0131 olabilir; Ubuntu 22.10 ve 23.04 i\u00e7in \u00f6nerilen bu y\u00f6ntem 24.04&#8217;te \u00fcrete\u00e7le \u00e7ak\u0131\u015f\u0131r. Dosyay\u0131 silip <code>daemon-reload<\/code> yap\u0131n.<\/li>\n<li><strong>Ba\u011flant\u0131 zaman a\u015f\u0131m\u0131na d\u00fc\u015f\u00fcyor.<\/strong> Yeni port g\u00fcvenlik duvar\u0131nda a\u00e7\u0131k de\u011fildir; kurallar i\u00e7in <a href=\"https:\/\/narhost.com\/destek\/ufw-guvenlik-duvari-kurulumu\/\" title=\"UFW G\u00fcvenlik Duvar\u0131 Kurulumu \u2014 Narhost Destek Merkezi\">UFW g\u00fcvenlik duvar\u0131 kurulumu<\/a> kart\u0131na bak\u0131n.<\/li>\n<li><strong>Ba\u011flant\u0131 kuruluyor ama giri\u015f reddediliyor.<\/strong> Sorun port de\u011fil kimlik do\u011frulamad\u0131r; <a href=\"https:\/\/narhost.com\/destek\/ssh-permission-denied-publickey-hatasi\/\" title=\"SSH Permission Denied (publickey) Hatas\u0131 \u2014 Narhost Destek Merkezi\">SSH Permission denied (publickey)<\/a> kart\u0131ndaki ad\u0131mlar\u0131 uygulay\u0131n.<\/li>\n<li><strong>Sunucuya hi\u00e7 giremiyorsunuz.<\/strong><a href=\"https:\/\/narhost.com\/destek\/konsol-baglantisi-ile-sunucuya-nasil-erisilir\/\" title=\"Konsol Ba\u011flant\u0131s\u0131 ile Sunucuya Eri\u015fim \u2014 Narhost Destek Merkezi\">Konsol ba\u011flant\u0131s\u0131 ile sunucuya eri\u015fim<\/a> kart\u0131yla girip ek dosyay\u0131 kald\u0131r\u0131n.<\/li>\n<\/ul>\n<div class=\"cta-box\">\n<p class=\"label\">Narhost deste\u011fi<\/p>\n<p>VPS ve VDS sunucular y\u00f6netimsizdir; SSH ayarlar\u0131 sizin sorumlulu\u011funuzdad\u0131r. Konsola da eri\u015femiyorsan\u0131z talebe sunucu ad\u0131n\u0131, de\u011fi\u015ftirdi\u011finiz portu ve son \u00e7al\u0131\u015ft\u0131rd\u0131\u011f\u0131n\u0131z komutlar\u0131 ekleyin.<\/p>\n<p><a class=\"cta-btn\" href=\"https:\/\/narhost.com\/submitticket.php\">Destek talebi a\u00e7<\/a><\/div>\n<div class=\"kb-ilgili\">\n<p class=\"label\">Sonraki ad\u0131mlar<\/p>\n<ul>\n<li><a href=\"https:\/\/narhost.com\/destek\/vps-vds-ilk-kurulum-rehberi\/\" title=\"VPS VDS Sunucu \u0130lk Kurulum Rehberi - Narhost Destek\">VPS VDS Sunucu \u0130lk Kurulum Rehberi (konu merkezi)<\/a><\/li>\n<li><a href=\"https:\/\/narhost.com\/destek\/ssh-portu-nasil-degistirilir\/\" title=\"SSH Portu Nas\u0131l De\u011fi\u015ftirilir \u2014 Narhost Destek Merkezi\">SSH portu nas\u0131l de\u011fi\u015ftirilir (VPS ilk kurulum 3\/10)<\/a><\/li>\n<li><a href=\"https:\/\/narhost.com\/destek\/permitrootlogin-no-ubuntu\/\" title=\"Ubuntu 24.04&#039;te SSH ile Root Giri\u015fi Nas\u0131l Kapat\u0131l\u0131r \u2014 Narhost Destek Merkezi\">Ubuntu 24.04&#8217;te SSH ile root giri\u015fini kapatma<\/a><\/li>\n<li><a href=\"https:\/\/narhost.com\/destek\/fail2ban-kurulumu\/\" title=\"Fail2ban Kurulumu ve SSH Korumas\u0131 \u2014 Narhost Destek Merkezi\">Fail2ban kurulumu ve SSH korumas\u0131<\/a><\/li>\n<li><a href=\"https:\/\/narhost.com\/blog\/ssh-key-mi-sifre-mi\/\" title=\"SSH Anahtar\u0131 m\u0131 Parola m\u0131 \u2014 Narhost Blog\">SSH anahtar\u0131 m\u0131 parola m\u0131, VPS&#8217;e g\u00fcvenli giri\u015f karar\u0131<\/a><\/li>\n<\/ul>\n<\/div>\n<div class=\"kb-faq\">\n<h2>S\u0131k\u00e7a sorulan sorular<\/h2>\n<h3>Ubuntu 24.04&#8217;te systemctl restart ssh neden portu de\u011fi\u015ftirmiyor?<\/h3>\n<p>\u00c7\u00fcnk\u00fc portu SSH hizmeti de\u011fil <code>ssh.socket<\/code> birimi dinler. Port de\u011fi\u015fikli\u011fi \u00f6nce <code>daemon-reload<\/code> ile soket ayar\u0131na aktar\u0131lmal\u0131, sonra <code>ssh.socket<\/code> yeniden ba\u015flat\u0131lmal\u0131d\u0131r. Yaln\u0131z hizmeti yeniden ba\u015flatmak soketi etkilemez.<\/p>\n<h3>SSH portunu de\u011fi\u015ftirmek g\u00fcvenli\u011fi art\u0131r\u0131r m\u0131?<\/h3>\n<p>Otomatik taramalar\u0131n ve g\u00fcnl\u00fcklerdeki g\u00fcr\u00fclt\u00fcn\u00fcn b\u00fcy\u00fck k\u0131sm\u0131n\u0131 azalt\u0131r, ama tek ba\u015f\u0131na koruma de\u011fildir. As\u0131l koruma parola giri\u015fini kapat\u0131p anahtar kullanmak, root giri\u015fini engellemek ve Fail2ban gibi bir ara\u00e7la deneme s\u0131n\u0131rlamakt\u0131r.<\/p>\n<h3>Ubuntu 22.04&#8217;te de ayn\u0131 ad\u0131mlar m\u0131 ge\u00e7erli?<\/h3>\n<p>Hay\u0131r. Ubuntu 22.04 LTS soket etkinle\u015ftirmesi kullanmaz; orada <code>Port<\/code> sat\u0131r\u0131n\u0131 de\u011fi\u015ftirip <code>sudo systemctl restart ssh<\/code> \u00e7al\u0131\u015ft\u0131rmak yeterlidir. Soket yap\u0131s\u0131 22.10 ile geldi, \u00fcrete\u00e7 ise 24.04&#8217;te eklendi.<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Ubuntu 24.04&#8217;te SSH ssh.socket ile ba\u015flat\u0131l\u0131r; Port sat\u0131r\u0131n\u0131 de\u011fi\u015ftirdikten sonra systemctl daemon-reload ve systemctl restart ssh.socket gerekir. G\u00fcvenlik duvar\u0131, ss ile do\u011frulama ve soket etkinle\u015ftirmesini kapatma ad\u0131mlar\u0131.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,13],"tags":[318],"class_list":["post-3048","post","type-post","status-publish","format-standard","hentry","category-vds-server","category-vps-server","tag-systemd"],"meta_box":[],"_links":{"self":[{"href":"https:\/\/narhost.com\/destek\/wp-json\/wp\/v2\/posts\/3048","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/narhost.com\/destek\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/narhost.com\/destek\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/narhost.com\/destek\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/narhost.com\/destek\/wp-json\/wp\/v2\/comments?post=3048"}],"version-history":[{"count":1,"href":"https:\/\/narhost.com\/destek\/wp-json\/wp\/v2\/posts\/3048\/revisions"}],"predecessor-version":[{"id":3116,"href":"https:\/\/narhost.com\/destek\/wp-json\/wp\/v2\/posts\/3048\/revisions\/3116"}],"wp:attachment":[{"href":"https:\/\/narhost.com\/destek\/wp-json\/wp\/v2\/media?parent=3048"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/narhost.com\/destek\/wp-json\/wp\/v2\/categories?post=3048"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/narhost.com\/destek\/wp-json\/wp\/v2\/tags?post=3048"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}