Add guide for disabling SSH password login - #932
Open
hanran-y wants to merge 1 commit into
Open
Conversation
New host page covering how to switch a machine to SSH key only login on Ubuntu Server 22.04 and 24.04, with the steps ordered so the reader proves their key works before turning passwords off. Covers two things that commonly trip people up: a stock Ubuntu install has password login on because the setting ships commented out and sshd defaults to yes, and a drop in under /etc/ssh/sshd_config.d/ overrides the main config file. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
New host guide for switching a machine to SSH key only login on Ubuntu Server 22.04 and 24.04.
host/disable-ssh-password-login.mdxhost/verification-stages.mdxSix steps, each one explanation, then the command, then the output to expect. The order matters: the reader proves key login works from a second terminal before turning passwords off, so a broken key cannot lock them out. A recovery section at the end covers getting back in over IPMI, iDRAC, iLO, or a directly attached monitor and keyboard.
Two things it deliberately covers, because both are easy to miss:
/etc/ssh/sshd_config.d/overrides the main config.sshd_configstarts withInclude /etc/ssh/sshd_config.d/*.confand OpenSSH keeps the first value it finds, so editingsshd_configalone can have no effect. Documented in the Ubuntu Server OpenSSH guide.Notes on the commands
ssh -o PreferredAuthentications=publickey, not-o PasswordAuthentication=no. The latter leaveskbdinteractiveauthentication yeson the client, so sshd can still prompt for a password and the check would pass without the key being used.sudo sshd -truns before every restart, so a bad config cannot take sshd down.systemctl restart ssh.serviceis correct on both releases. Ubuntu 24.04 socket activates sshd and 22.04 does not, but that does not change this command.Test plan
docs.jsonparsesssh-keygenandssh-copy-idoutput blocks taken from real output, not paraphrasedPreferredAuthentications=publickeyverified against the ssh client withssh -G