使用SecureCRT 連接Win10內(nèi)置ubuntu遇到了一些問題, 記錄一下.
先通過 ifconfig 查看 ubuntu的ip.?
Q1: 輸入hostname, username 后連接提示: ubuntu The remote system refused the connection.
? 因?yàn)闆]有安裝或啟動(dòng) ssh.? 使用命令 su root 切換至root用戶.? ? 使用命令 ps -e | grep ssh 查看是否啟動(dòng) ssh.
?如沒有返回 則嘗試使用命令 sudo apt install openssh-server? 嘗試安裝ssh.?
如提示已安裝,? 使用命令 /etc/init.d/ssh start 啟動(dòng)ssh服務(wù). 再次嘗試連接? ?
//相關(guān)命令 停止服務(wù)/etc/init.d/ssh stop? ? 重啟服務(wù)/etc/init.d/ssh restart
Q2: could not load host key.?
?查了下大概是因?yàn)殍b證證書的問題? 使用命令 ssh-keygen -A? 生成key
Q3: a public key file has not been specified for this session would you like to specify one now
在SecureCRT sessions > properties > Connection > SSH2? 取消勾選 PublicKey.
Q4: Reason: Unable to authenticate using any of the configured authentication methods.
?修改sshd_config配置信息 vim /etc/ssh/sshd_config? 配置項(xiàng) PasswordAuthentication 值no改為yes? 修改后 使用命令 /etc/init.d/ssh restart?重啟ssh服務(wù).
附上 vim基本命令.
ESC 退出編輯模式.????????:w 保存文件但不退出vi
:w! 強(qiáng)制保存,不退出vi????????:wq 保存文件并退出vi?
:wq! 強(qiáng)制保存文件并退出vi? ? ? ? :q 不保存文件 退出vi
:q! 不保存文件 強(qiáng)制退出vi
Q5: The server has disconnected with an error. Server message reads: A protocol error occurred. Change of username or service not allowed: (root,ssh-connection) -> (xxxxxx,ssh-connection)
因?yàn)镾ecureCRT設(shè)置的用戶名和登錄時(shí)輸入的用戶名不一致典蜕,在SecureCRT sessions > properties > Connection > SSH2? username 修改一致即可.
到此為止, 終于連接成功了. 學(xué)習(xí)的過程中有問題要擅于使用搜索引擎.