Update 'secure-ssh.md'

This commit is contained in:
Samuel Philipp 2021-02-20 13:11:39 +00:00
parent fb386371b2
commit 7799de5738

View file

@ -12,15 +12,7 @@ Create a new key pair on your client:
ssh-keygen -b 4096 ssh-keygen -b 4096
``` ```
Remember the path and password you choosed. Append the created public key from `/<your-path>/<key-name>.pub` on your client in the `/home/<user>/.ssh/authorized_keys`. Remember the path and password you choosed. Append the created public key from `/<your-path>/<key-name>.pub` on your client in the `/home/<user>/.ssh/authorized_keys` on your server.
If you changed the path you can add the following to your `~/.ssh/config` file on your client:
```
Host <your-host-or-ip>
User <the-server-username> # optional
IdentityFile /<your-path>/<key-name>
```
Now edit `/etc/ssh/sshd_config` on your server and set the following values: Now edit `/etc/ssh/sshd_config` on your server and set the following values:
@ -30,3 +22,15 @@ AuthorizedKeysFile .ssh/authorized_keys
PasswordAuthentication no PasswordAuthentication no
``` ```
If you changed the path you can add the following to your `~/.ssh/config` file on your client:
```
Host <your-host-or-ip>
User <the-server-username> # optional
IdentityFile /<your-path>/<key-name>
```
## Apply Changes
To apply changes you made in the ssh config simply run `systemctl restart ssh.service` or `service ssh restart`.