跳到主內容

【Linux】禁止密碼登入(使用金鑰)

修改 /etc/ssh/sshd_config

vim /etc/ssh/sshd_config

## 修改 PubkeyAuthentication

PubkeyAuthentication yes
#使用 ssh key 登入
PasswordAuthentication no
#禁止密碼登入

重啟 ssh 服務

sudo systemctl restart sshd.service