SSH 安全強化
停用密碼登入,僅允許金鑰認證
Overview
停用密碼登入,僅允許金鑰認證
Commands
這將停用 SSH 密碼登入(僅允許金鑰)。請先確認您的 SSH 金鑰已設定完成!是否繼續?
sudo sed -i "s/^#\?PasswordAuthentication.*/PasswordAuthentication no/" /etc/ssh/sshd_config
sudo sed -i "s/^#\?PermitRootLogin.*/PermitRootLogin prohibit-password/" /etc/ssh/sshd_config
sudo systemctl restart sshd