小编nek*_*uuu的帖子

如何在 Windows 上的 bash 中使用启动命令

我想在 Windows上的 Ubuntu(即 WSL)上的 bash 中使用 Windowsstart命令。但是,我不能通过简单地输入来使用它start

nek@NEK:/mnt/c/Users/Nek$ start test.txt
Command 'start' is available in '/sbin/start'
The command could not be located because '/sbin' is not included in the PATH environment variable.
This is most likely caused by the lack of administrative privileges associated with your user account.
start: command not found
Run Code Online (Sandbox Code Playgroud)

我注意到这start.exe可能不存在。

C:\Users\Nek>where start
INFO: Could not find files for the given pattern(s).
Run Code Online (Sandbox Code Playgroud)

start内置命令吗?我们可以start在 bash 中使用吗?

环境

  • Windows …

windows windows-subsystem-for-linux

5
推荐指数
2
解决办法
2万
查看次数

当我们使用Windows 10 OpenSSH服务器和WSL2时,我们应该在哪里找到authorized_keys?

我设置了 Windows 10 的 OpenSSH 服务器,通过本文中描述的方法建立到 WSL2 bash 的 ssh 连接:“THE EASY WAY how to SSH into Bash and WSL2 on Windows 10 from an external machine”,以及本文档:“OpenSSH key管理”

总之,我以管理员身份在 PowerShell 上运行以下命令:

Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
Start-Service sshd
New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\WINDOWS\System32\bash.exe" -PropertyType String -Force
Run Code Online (Sandbox Code Playgroud)

之后,我可以ssh <my Windows username>@localhost使用 Windows 密码通过 ssh 从 PowerShell 连接到本地主机上的 WSL2 bash。

接下来,我想不使用密码而是使用密钥对进行连接。因此,我在 PowerShell 上创建了一个密钥对并将其定位为C:\Users\<my Windows username>\.ssh\authorized_keys.

cd C:\Users\<my Windows username>\.ssh
ssh-keygen -t ed25519 -f …
Run Code Online (Sandbox Code Playgroud)

ssh windows-10 windows-subsystem-for-linux wsl2

2
推荐指数
1
解决办法
4255
查看次数