
Ssh Hardening
This hardens SSH on your VPS by creating a non-root sudo user, setting up key-based authentication, and disabling password login and root access. You'd use it when spinning up a new server or fixing an existing one that's still using passwords and allowing root login. The documentation is thorough about the "keep a session open while testing" warnings, which matters because it's easy to lock yourself out if you disable password auth before confirming your SSH keys work. Covers Ubuntu, Debian, CentOS, and RHEL with step-by-step commands for the full workflow from ssh-keygen through sshd_config changes. The troubleshooting section assumes you've already made the mistake, which is realistic.
- skills.sh installs
- 257
- GitHub stars
- 7
- last updated
- Aug 21, 2026
Install
$ npx -y skills add mikr13/secure-server-setup-skills --skill ssh-hardening --agent claude-codeInstalls into .claude/skills of the current project.
Files
SSH hardening
Establish working administrative access before restricting authentication. Keep the current session and provider console available until a fresh post-change login succeeds.
Inspect and establish access
-
Identify the active daemon/service/socket, actual listener ports, administrative and automation identities,
Includeorder, and relevantMatchrules. Recordsshd -T -Cresults for the actual users, client addresses, and hostnames. -
Use an existing non-root administrator. If account creation is needed, create it separately with the distribution's user/group conventions, install its public key, then prove key login and sudo in a separate session before any lockdown.
-
Generate personal keys on the local client with a passphrase or hardware-backed key. scripts/generate-ssh-keys.sh provides preview/no-overwrite behavior; its
--interactivemode is for a human terminal and--no-passphraseis an explicit service-key choice. -
Test the specific key without password fallback:
ssh -o IdentitiesOnly=yes -o PreferredAuthentications=publickey -i ~/.ssh/server_admin administrator@server.example.com
Sponsors
Details
- Repository
- github.com/mikr13/secure-server-setup-skills
- Categories
- Backend & APIs, Security
- First seen
- Jun 3, 2026