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

修改 /etc/ssh/sshd\_config

```shell
vim /etc/ssh/sshd_config

## 修改 PubkeyAuthentication

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

重啟 ssh 服務

```shell
sudo systemctl restart sshd.service
```