简体   繁体   English

如何将 ssh 文件夹从 Windows 正确同步到 WSL1?

[英]How to sync .ssh folder from Windows to WSL1 correctly?

I want to sync C:\Users\USERNAME\.ssh and ~/.ssh in WSL1 correctly, but I don't know how to achieve that.我想在 WSL1 中同步C:\Users\USERNAME\.ssh~/.ssh .ssh 正确,但我不知道如何实现。 I tried to use ln -s /mnt/c/Users/USERNAME/.ssh/.ssh , and it does create a symbolic link as I expect.我尝试使用ln -s /mnt/c/Users/USERNAME/.ssh/.ssh ,它确实按我的预期创建了一个符号链接。 But ssh don't like permission of files in ~/.ssh (0777), and chmod doesn't work here.但是 ssh 不喜欢~/.ssh (0777) 中文件的权限,并且chmod在这里不起作用。 (Maybe because they are files under NTFS.) (可能是因为它们是 NTFS 下的文件。)

Is there a way to mock the permission so that ssh could accept it?有没有办法模拟权限以便 ssh 可以接受它? Or is there are a better way to do this than symbolic link?或者有比符号链接更好的方法吗?

If a symlink approach is not possible, you might want to synchronize on demand, meaning manually copy, your keys from your %USERPROFILE%\.ssh folder to the one representing $HOME for WSL1.如果无法使用符号链接方法,您可能希望按需同步,即手动复制您的密钥从%USERPROFILE%\.ssh文件夹到代表 WSL1 的$HOME的文件夹。
See " What is the home directory on Windows Subsystem for Linux? ", For example C:\Users\<username>\AppData\Local\lxss .请参阅“ Linux 的 Windows 子系统上的主目录是什么? ”,例如C:\Users\<username>\AppData\Local\lxss

This might be easier to do with WSL2 though .不过,这可能更容易使用WSL2来完成。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM