简体   繁体   中英

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. I tried to use ln -s /mnt/c/Users/USERNAME/.ssh/.ssh , and it does create a symbolic link as I expect. But ssh don't like permission of files in ~/.ssh (0777), and chmod doesn't work here. (Maybe because they are files under NTFS.)

Is there a way to mock the permission so that ssh could accept it? 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.
See " What is the home directory on Windows Subsystem for Linux? ", For example C:\Users\<username>\AppData\Local\lxss .

This might be easier to do with WSL2 though .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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