使用 password 登入 SSH
linux ssh password -sudo sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config
sudo systemctl restart sshd.service
Why
現在還有人用 username/password 來登入主機?
但有些老人實在不習慣用 authorized_keys,所以還是寫一下註記。
How
首先找到主機上 sshd 的設定檔,一般可能是 /etc/ssh/sshd_config。
要注意是 sshd 不是 ssh。
因為 sshd_config 是 SSH Server 用的設定檔。
而 ssh_config 是 SSH Client 用的設定檔。
將其中 PasswordAuthentication 的設定由 no 改為 yes。
或,執行下面的指令
sudo sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config
然後,必須重啟你的 SSH Server。
sudo systemctl restart sshd.service
就完事了。
用 fd 替代 find
<<
>>
去掉空白行