ubuntu 24.04 安裝好之後突然發現我用 putty 進不去ssh操作
每次都只會出現:
PuTTY Fatal Error
No Supported authentication methods available (server sent: publickey)
然後就連密碼都沒打到就被踢出來了........
後來找到一堆說要去修改
/etc/ssh/sshd_config (我好像還看到了一個 ssh_config的檔案)
Port 22 '要使用22port連線
PasswordAuthentication yes '要開放使用密碼驗證
PermitRootLogin yes '要不要開放使用root帳號登入?? 你自己考慮好喔!!!
改好存檔要重啟服務一次
/etc/init.d/ssh restart
or
sudo systemctl restart ssh
反正搞了好久,我使用:
sudo sshd -T|grep auth
'後面的|grep auth 意思是只列出 auth 字眼的相關字,不想過濾不用加這個
去查我改過的設定 他還給我顯示我不允許使用密碼登入,我也一頭霧水了
後來就一頓移除安裝移除安裝
sudo apt-get remove openssh-server
sudo apt-get install openssh-server
幾次之後居然壞得更嚴重了@@
安裝時出現錯誤訊息了,原來還能安裝完成@@
Setting up openssh-setver (1:9.6p1-3ubuntu13.5) ...
Not replacing deleted config file /etc/ssh/sshd_config
dpkg: error processing package openssh-server (--configure):
installed openssh-server package port-installation script subprocess returned error exit status 1
Errors were encountered while processing:
openssh-server
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)
還好後來找到一個 移除設定檔 的參數吧
sudo apt-get purge openssh-server
然後再安裝回來
sudo apt-get install openssh-server
他救回來了.................
沒有留言:
張貼留言