要在Debian上禁用SFTP密碼登錄,您需要編輯SSH配置文件并修改相關設置。請按照以下步驟操作:
打開終端。
使用文本編輯器打開SSH配置文件。在這個例子中,我們將使用nano編輯器。輸入以下命令:
sudo nano /etc/ssh/sshd_config
#PasswordAuthentication yes
yes
更改為no
,以禁用密碼登錄:PasswordAuthentication no
#PubkeyAuthentication yes
取消注釋(刪除行首的#符號),并將yes
更改為no
:
PubkeyAuthentication no
保存并關閉配置文件。在nano編輯器中,按Ctrl + X
,然后按Y
,最后按Enter
。
重啟SSH服務以應用更改:
sudo systemctl restart ssh
現在,SFTP密碼登錄已被禁用。用戶需要使用密鑰對進行身份驗證才能訪問SFTP。