SecureCRT 连接Win10内置ubuntu问题层层突围

1、安装windows10内置的linux子系统(windows10 2004版本据说有linux内核)
运行->appwiz.cpl->启用或关闭windows功能->勾选适用于linux的windows子系统
后面就按照提示下载相应的ubuntu包就可以。
在cmd或powershell命令窗口中输入bash或wsl就可以进入ubuntu系统,如果你windows使用的管理员权限登录,进去后是root身份。
在这里插入图片描述
ifconfig -a查看了下ip 其实就是自己本机的ip嘛,那就用securecrt去连下,以方便使用。
2、输入hostname, username 后连接提示: ubuntu The remote system refused the connection.

因为没有安装或启动 ssh. 使用命令 su root 切换至root用户. 使用命令 ps -e | grep ssh 查看是否启动 ssh.

如没有返回 则尝试使用命令 sudo apt install openssh-server 尝试安装ssh.

如提示已安装, 使用命令 /etc/init.d/ssh start 启动ssh服务. 再次尝试连接

//相关命令 停止服务/etc/init.d/ssh stop 重启服务/etc/init.d/ssh restart

3、could not load host key.
查了下大概是因为鉴证证书的问题 使用命令 ssh-keygen -A 生成key

4、a public key file has not been specified for this session would you like to specify one now
在SecureCRT sessions > properties > Connection > SSH2 取消勾选 PublicKey.
在这里插入图片描述
5、Reason: Unable to authenticate using any of the configured authentication methods.
修改sshd_config配置信息 vim /etc/ssh/sshd_config 配置项 PasswordAuthentication 值no改为yes 修改后 使用命令 /etc/init.d/ssh restart 重启ssh服务.
6、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)
因为SecureCRT设置的用户名和登录时输入的用户名不一致,在SecureCRT sessions > properties > Connection > SSH2 username 修改一致即可.
或者用securecrt重新创建个连接。
7、如果还是连接不上,仍然报用户名和密码错误:Password authentication failed.Please verify that the username and password are correct.

vim /etc/ssh/sshd_config

1)、找到# port 22所在的那一行,复制该行内容并修改。

将“#port 22”修改为“port 22”(将前面的“#”去掉)。

该行内容为设置SSHd服务的端口号

2)、找到#PermitRootLogin prohibit-password那一行,复制该行内容并修改。

将“#PermitRootLogin prohibit-password”修改为“PermitRootLogin yes”

改行内容为设置允许root用户远程登录。

最后停止服务/etc/init.d/ssh stop 重启服务/etc/init.d/ssh restart

安全提示:当你这样设置后,你的电脑就面临着安全风险,windows系统中的超级管理员有各种组策略限制远程登录。而使用linux子系统的root远程登录一定要谨慎。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章