SSH – Connect by Key: 2. Setting Server and Client

Author: - Posted: 02/05/22 - Update: 06/09/22

Giả sử ta đã có 1 cặp key là: version_schat và version_schat.pub
- Phía Client sẽ dùng private key: version_schat
- Phía Server sẽ dùng publickey: version_schat.pub

1. Config server

1.1. Cấu hình sshd
Với Ubnuntu: /etc/ssh/sshd_config
Với Windows C:\ProgramData\sshd_config

Bật xác thực bằng Key lên

PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys

1.2. Thêm public key

2. Client thử connect bằng private key

2.1. Connect đơn giản

2.2. Config Client
Để connect đơn giản cho những lần sau, có thể dùng file config schat
- Tạo file config

- Sửa file config

- Thử kết nối