This topic created in 1519 days ago, the information mentioned may be changed or developed.
场景
- window 用 powershell 开启了 ssh
- wsl(ubuntu20.04)也开启了 ssh
问题
- 两者 ip 地址是一样的,那远程 ssh 登陆时是如何判别进入哪个环境呢?
-
目前远程登陆使用 powershell 里 whoami 命令得到的用户名可以登陆到 powersehll 环境,但有两个问题:
- 登陆密码不是系统的 pin 码,而是微软账户密码
- 登陆进去 oh-my-posh, powerline-10k, 自动补全等插件都没生效(怀疑是以管理员权限进去的)
- 使用 ubuntu 下的用户名登陆,输入正确密码限时
Permission denied, please try again,这个报错是我之前用 pin 码登陆 powershell 时报的错,应该是密码不正确或者用户不存在导致的.所以要怎么才能登上我的 wsl 呢?
5 replies • 2022-03-19 20:55:49 +08:00
 |
|
1
noe132 Mar 19, 2022 1
你得在 /etc/ssh/sshd_config 用另外一个端口。默认 22 端口是 windows openssh server ,除非你关闭 windows openssh server
|
 |
|
3
lithiumii Mar 19, 2022 via Android 1
默认远程 ssh 会进入到 powershell ,这时候在 powershell 里输入 wsl 就可以进到默认的 wsl 了,如果有多个 wsl 的话可以查一下 wsl 命令的用法,应该是 wsl -d <distro name> 进到指定的 distro
另外可以修改默认的 ssh shell 直接进入 wsl ,在管理员 powershell 运行
"C:\Windows\System32\wsl.exe" -PropertyType String -Force
不推荐把默认的 shell 换成 wsl ,因为你可以从 powershell 进入任意 wsl ,但不能反过来
|