Open dyanakiev opened 4 years ago
You can set mnt/c/Users/xxx
as your home-folder in /etc/passwd
.
The solution indicated by @ad-on-is (clever name!) is what I have done:
/home/<user_name>
(especially the startup files like.bashrc,
and the administration directories like .ssh) to the future new home /mnt/c/Users/<user_name>
./etc/passwd
file (you will need administration/sudo privileges); 1000:1000
as your UID (User ID) and GID (Group ID): that is what WSL assigns as the default account when you first install the distro.:/home/<user_name>
). Change that to the mounted directory /mnt/c/Users/<user_name>
.sc stop LxssManager
sc start LxssManager
At this point, your WSL window should come up exactly as before, but with the new directory as the home directory.
NOTES:
VoIFs
file system (assuming you're still using WSL, and not WSL2. )drivefs
file system. This might seem transparent to most people, but it is what allows you to work on the file system in both Windows and WSL...One more remark: if you want to KEEP your home in /home/<username>
, but make it CORRESPOND to your /mnt/c/Users/<user_name>
, you could bind it in your /etc/fstab
...
Let me know if that needs to be explained in more detail.
Come to think of it, if this feature does get approved and implemented, that's probably how it should be done:
/home/<user_name>
directory./mnt/c/Users/<user_name>
to it in /etc/fstab
./etc/fstab
.Since there are still I/O performance issues with /mnt, I personally wouldn't want this to be the default setup when installing a distro.
@beltaurus Thx, I carry that nickname since the early 2000s, being that nerdy friend who's always ON-line.
Currently im not using WSL 1 or 2, im waiting for the new stable windows update with WSL 2 to be released and then i will play with that. In the past i used my windows home folder with the /etc/passwd path change method, there where some permissions issues that i solved by modifying the wsl conf. Mainly i stopped using WSL because of some performance issues, but i will give it a try again with WSL2.
As I mentioned, performance issues are due to I/O speeds on /mnt, which are not better in WSL2, some say it's even worse compared to WSL1.
But when working with WSL2, it's recommended to store your work-files inside /home/user, where performance is nearly bare-metal.
I would like it to be configurable to make it the default to save the hassle of modifying the /etc/passwd file. It would also make it a more seamless experience for most people who are dabbling on it.
So, not complaining because I knew I'd screw something up here. I did the above mentioned solution and broke docker desktop. I think it was because I copied all (I mean ALL) files and folders over blindly. When I installed docker, it created a .docker folder in my windows home dir and in the wsl home dir. Apparently they have different contents or the permissions to the directory might be a problem. But when I copied, it overwrote the existing one. To fix it I did a full purge and reset on docker, renamed the .docker folder, restarted windows and then all was good. Docker re-created the .docker folder and I opened a terminal (wsl working on new home directory) and recreated all my images and deployments.
All this just so I could have
isimmons33@xpsdt:~/code/node/udemy_steven_grider/microservice_course/blog/infra/k8s$
instead of
isimmons33@xpsdt:/mnt/c/Users/isimm/code/node/udemy_steven_grider/microservice_course/blog/infra/k8s$
It helps keep the long path from wrapping in terminal inside vscode
I should probably move work like this into /home/user anyway and then use \wsl$ if I need to access the files in explorer
Is your feature request related to a problem? Please describe. I need to manage .ssh keys both on windows and linux, this will help that, and other stuff.
Describe the solution you'd like Allow using windows home folder as linux home folder.