文|Seraph
00 | 常用命令
命令 | 含義 |
---|---|
logout/exit | 退出ssh登錄 |
01 | 安裝與遠程設置
- ubuntu下使用
sudo apt install ssh
命令安裝即可。 - 修改
/etc/ssh/sshd_config
配置文件。
- 註釋掉
PermitRootLogin prohibit-password
,添加PermitRootLogin yes
允許root賬戶遠程登錄。
- 重啓ssh服務:
sudo service ssh restart
。
02 | 問題解決
- 當系統遠程的linux重置後,進程發現ssh遠程不了,這個時候需要清除使用ssh訪問過的計算機的公鑰,才能重新連接。
解決:使用rm -rf ~/.ssh/kown_hosts
刪除所有的公鑰,也可修改kown_hosts
文件,只刪除錯誤的公鑰信息。
亦可使用ssh-keygen -R IP
指令清除指定IP的密鑰。默認是22端口,如果是其它端口:ssh-keygen -R [IP]:port
03 | 其它
- 端口映射監聽:
ssh -p 30008 -N -f -L 127.0.0.1:30099:10.18.101.90:30011 [email protected]