Manage SSH keys and password authentication on Ubuntu with a single script.
curl -sSL https://raw.githubusercontent.com/Yesmohsen/SSHmanager/main/ssh-manager.sh -o ssh-manager.sh && chmod +x ssh-manager.sh && sudo ./ssh-manager.sh| # | Option | Description |
|---|---|---|
| 1 | Add SSH Public Key | Append a public key to ~/.ssh/authorized_keys with correct permissions |
| 2 | Import SSH Private Key | Copy a private key to ~/.ssh/ and set 600 permissions |
| 3 | Disable Password Authentication | Set PasswordAuthentication no in /etc/ssh/sshd_config and restart SSH |
| 4 | Enable & Reset Login Password | Re-enable password auth in SSH and set a new user password |
| 5 | Add Key + Disable Password | Lock down to key-only access in one step |
| 6 | Remove Key + Enable Password | Remove a selected public key and re-enable password auth |
| 7 | Remove Key + Enable PW + Reset | Full rollback: remove key, enable password, and reset password |
./ssh-manager.sh./ssh-manager.sh --add-key ~/.ssh/id_ed25519.pub
./ssh-manager.sh --import-key ~/downloaded_private_key
./ssh-manager.sh --list-keys
./ssh-manager.sh --remove-key <index>
./ssh-manager.sh --disable-password
./ssh-manager.sh --enable-password
./ssh-manager.sh --reset-password
./ssh-manager.sh --help- Key operations (options 1-2) need no sudo — they only touch
~/.ssh/ - System operations (options 3-7) modify
/etc/ssh/sshd_configand require sudo - Backups:
sshd_configis backed up to~/.ssh-manager/backups/before any change - Duplicate prevention: public keys already in
authorized_keysare detected and skipped - Safety: destructive operations prompt for confirmation before proceeding
- Ubuntu (or any Debian-based distro with OpenSSH server)
bash,sudo,systemctl/service