SSH Configuration
SSH Daemon (sshd) Configuration File
The SSH daemon settings can be entirely configured through its configuration
file located at /etc/ssh/sshd_config
. Use a text editor to modify it.
Recommended settings:
PermitRootLogin no
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
PasswordAuthentication no
How To Use SSH Keys
The client creates a private key and sends a public key to the server.
Private <-> Client
Public <-> Server
- Create key pair in client
$ ssh-keygen -b 4096
- Copy public key to server
$ ssh-copy-id -i ~/.ssh/mykey.pub user@127.0.2.1
- Start SSH authentication agent
$ eval $(ssh-agent -s)
- Add private key to ssh-agent
$ ssh-add ~/.ssh/id_rsa