简体   繁体   English

从 WSL(Linux 的 Windows 子系统)写入 Windows 磁盘

[英]Write to windows disk from WSL (Windows subsystem for Linux)

I'm in need to share files between Linux (using WSL) and Windows, so that I can edit in Windows and compile in Linux.我需要在 Linux(使用 WSL)和 Windows 之间共享文件,以便我可以在 Windows 中编辑并在 Linux 中编译。 According to recomendations from Microsoft I should then keep my shared files under the drive in /mnt/ (/mnt/c/ in my case).根据微软的建议,我应该将我的共享文件保存在 /mnt/(在我的情况下为 /mnt/c/)的驱动器下。 Problem I have is that trying to write to that drive in Linux yields a Operation not permitted, I need to do sudo for all writes.我遇到的问题是,尝试在 Linux 中写入该驱动器会产生不允许的操作,我需要对所有写入执行 sudo。 How can I change this so that I have write possiblitites from my Linux?我该如何更改它以便我可以从我的 Linux 中编写可能的内容?

thanks谢谢

In WSL /mnt/c is a mount of the root of drive C ( C:\\ ) in Windows.在 WSL 中/mnt/c是 Windows 中驱动器 C ( C:\\ ) 根目录的安装。 You should not store files in the root of Windows' system drive - this is normally write protected for normal users which I guess is what you experience.您不应该将文件存储在 Windows 系统驱动器的根目录中 - 这通常是对普通用户的写保护,我猜这就是您的体验。

The correct thing to do is moving in deeper to your Windows user folders, fx /mnt/c/Users/YOU/Documents .正确的做法是深入到您的 Windows 用户文件夹 fx /mnt/c/Users/YOU/Documents Here you are permitted to write files from WSL.在这里,您可以从 WSL 写入文件。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从 Sublime Text 使用 Windows Subsystem for Linux (WSL) - Using Windows Subsystem for Linux (WSL) from Sublime Text 如何在 Windows 10 上使用 VSCodium 设置 Windows 子系统 Linux (WSL 2) - How to setup Windows Subsystem Linux (WSL 2) with VSCodium on Windows 10 Crontab 未在 Windows Subsystem for Linux (WSL) 上运行 python 脚本 - Crontab not running python script on Windows Subsystem for Linux (WSL) 是否可以在Windows Subsystem for Linux(WSL)-Ubuntu上安装IBM Java? - Is it possible to install IBM java on Windows Subsystem for Linux (WSL) - Ubuntu? 从 local.network 访问运行在 WSL(Linux 的 Windows 子系统)上的 web 服务器 - Access a web server which is running on WSL (Windows Subsystem for Linux) from local network 如何从 Windows Linux 子系统打开 VSCode? - How to open VSCode from a Windows Linux Subsystem? 当 windows PATH 包含带空格的文件夹名称时,WSL(Windows 子系统 linux)会中断 $PATH - WSL (windows subsystem linux) breaks $PATH when the windows PATH has folder names with spaces Substrate:Windows 中的“cargo build --release”,honggfuzz-rs 目前不支持 Windows,但在 WSL(Windows Subsystem for Linux)下运行良好 - Substrate: "cargo build --release" in Windows, honggfuzz-rs does not currently support Windows but works well under WSL (Windows Subsystem for Linux) 在适用于Linux的Windows子系统上安装Apache - Installing Apache on Windows Subsystem for Linux 在带有 Linux 子系统的 Windows 上取消共享文件夹 - Unshare a folder on Windows with Linux subsystem
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM