2

I have the Win10/bash shell enabled on my computer and would like to share the files from "my documents" folder with Bash. I have followed the following instructions* from my university, but I can't get it to work and they don't know what's going on; they have recommended to switch to Cygwin, but I first want to see if I can get this issued fixed before deciding to switch.

Please help.

*Instructions: You can access your Ubuntu home directory from Windows in the directory c:\Users\YourUserName\AppData\Local\lxss. You can unhide the lxss directory with the Windows command (Windows command prompt, not Ubuntu command prompt) by navigating to c:\Users\YourUserName\AppData\Local using the Windows cd command and running:

attrib * . * -h –s /s /d

Sharing Files Between Bash and Windows

Follow the steps below to create a home directory accessible from both Windows and Bash. Pay close attention to whether the commands are for the Windows command prompt or for the Bash command prompt, because they are not the same thing!

1. From the Windows command prompt run the command shown below to change the Bash user to root:

lxrun /setdefaultuser root

cd \

mkdir \home\yourusername

In place of yourusername type your actual username.

2. Bash should now show you logged in as root. Run this command in Bash to change your home directory:

usermod –d /mnt/c/home/yourusername

3. From the Windows command prompt run the command below to switch back to your regular user ID:

lxrun /setdefaultuser yourusername

Now you can download files into c:\home\username and have them also be visible in Bash. You can also edit files there as long as the application uses Linux line breaks. Eclipse, for example, can be configured to use Linux line break format. Be sure to use Linux-compatible filenames when downloading or editing files from Windows within c:\home\yourusername.

  • 2
    Why not just navigate to your Windows' My Documents folder as a link or such, and then just access things that way? ln -s /home/$USER/My_Documents '/mnt/c/Users/[WINDOWS USERNAME]/My Documents' and then just use that inside Bash on Windows every day? This would permit you to just access it like a normal folder. I would suggest doing this instead of trying to create a mount point in the C:\ drive for your Linux home directory, since Bash on Windows will enforce UNIX-style permissions there which won't work on Windows, and will break Bash/Linux. – Thomas Ward Apr 27 '17 at 20:55
  • I tried that but I get the same problem; the folder is there in Windows, but when I add anything to it (from Windows), it doesn't show up in Bash. – Moneeb Irshad Bajwa Apr 27 '17 at 22:23

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.