diff --git a/docs/manager/basic-concepts-and-troubleshooting/Disable-SSH-Password-Authentication.fa.md b/docs/manager/basic-concepts-and-troubleshooting/Disable-SSH-Password-Authentication.fa.md index f00d89e64..2d61360db 100644 --- a/docs/manager/basic-concepts-and-troubleshooting/Disable-SSH-Password-Authentication.fa.md +++ b/docs/manager/basic-concepts-and-troubleshooting/Disable-SSH-Password-Authentication.fa.md @@ -79,6 +79,27 @@ PasswordAuthentication no 4. **ذخیره و خروج از ویرایشگر**: اگر از `nano` استفاده می‌کنید، می‌توانید با فشار دادن `Ctrl + O` ذخیره کنید و با فشار دادن `Ctrl + X` خارج شوید. +5. **مهم — بررسی بازنویسی (override) مربوط به Cloud-Init**: در بسیاری از سرورهای ابری (برای مثال image‌های اوبونتو در Azure، AWS، Oracle Cloud، Hetzner، Vultr و ...)، یک فایل تنظیمات جداگانه، ورود با رمز عبور را دوباره فعال می‌کند. فایل اصلی `sshd_config` این فایل‌ها را در ابتدای خود با خطی مانند `Include /etc/ssh/sshd_config.d/*.conf` بارگذاری می‌کند و SSH برای هر گزینه از **اولین** مقداری که پیدا کند استفاده می‌کند؛ بنابراین مقدار داخل این فایل، مقداری را که در مرحله قبل تنظیم کردید بازنویسی می‌کند. این رایج‌ترین دلیلی است که چرا با وجود تنظیم `PasswordAuthentication no` در فایل اصلی، ورود با رمز عبور همچنان کار می‌کند. + + بررسی کنید که آیا این فایل وجود دارد و در صورت وجود، آن را باز کنید: + +
+ +```bash +sudo nano /etc/ssh/sshd_config.d/50-cloud-init.conf +``` +
+ + اگر این فایل وجود دارد و شامل `PasswordAuthentication yes` است، آن را به + +
+ +```bash +PasswordAuthentication no +``` +
+ تغییر دهید، سپس مانند مرحله قبل ذخیره کرده و خارج شوید. (اگر این فایل وجود ندارد، می‌توانید از این مرحله عبور کنید.) + ### گام ۳: راه‌اندازی مجدد سرویس SSH پس از ایجاد تغییرات در فایل `sshd_config`، باید سرویس SSH را برای اعمال تغییرات مجدداً راه‌اندازی کنید. diff --git a/docs/manager/basic-concepts-and-troubleshooting/Disable-SSH-Password-Authentication.md b/docs/manager/basic-concepts-and-troubleshooting/Disable-SSH-Password-Authentication.md index a06a8223c..844bed63b 100644 --- a/docs/manager/basic-concepts-and-troubleshooting/Disable-SSH-Password-Authentication.md +++ b/docs/manager/basic-concepts-and-troubleshooting/Disable-SSH-Password-Authentication.md @@ -55,6 +55,18 @@ Before you disable password authentication, make sure you have key-based authent 4. **Save and Exit the Editor**: If you are using `nano`, you can save by pressing `Ctrl + O` and exit by pressing `Ctrl + X`. +5. **Important — Check for a Cloud-Init Override**: On many cloud servers (for example, Ubuntu images on Azure, AWS, Oracle Cloud, Hetzner, Vultr, etc.), an additional drop-in configuration file re-enables password login. The main `sshd_config` loads these files near its top with a line such as `Include /etc/ssh/sshd_config.d/*.conf`, and SSH uses the **first** value it finds for each option — so a value inside the drop-in file overrides the one you set above. This is the most common reason password login still works even after setting `PasswordAuthentication no` in the main file. + + Check whether this file exists and, if so, open it: + ```bash + sudo nano /etc/ssh/sshd_config.d/50-cloud-init.conf + ``` + If the file exists and contains `PasswordAuthentication yes`, change it to: + ```bash + PasswordAuthentication no + ``` + Then save and exit as in the previous step. (If the file does not exist, you can skip this step.) + ### Step 3: Restart the SSH Service After making changes to the `sshd_config` file, you need to restart the SSH service for the changes to take effect.