Skip to content

Instantly share code, notes, and snippets.

What would you like to do?

Scenario: Wanting to add a virtualhost file to Apache2, which was installed using apt while in bash

Assumption: /etc/apache2 in bash maps to %HOME%\AppData\Local\lxss\rootfs\etc\apache2

  1. Opened a Windows-linux bash shell
  2. Installed apache2 (sudo apt-get install ...)
  3. Wanted to add a virtual host file that had been used on another dev machine
  4. Decided that editing files with vi in the bash terminal was too annoying :)
  5. Found the matching "sites-available" folder via Win10 File Explorer.
  6. Copied an existing virtualhost file itno that folder
  7. Checked, in bash, that the new file was there. No sign of this file.
  8. As an experiment, created, in bash, a test file (in sites-available): sudo vi test.conf
  9. Added some random text and save it
  10. The file is visible in Win 10 File Explorer (as well from a stand Windows cmd shell)
  11. I was able to edit that file in Windows, and back in bash I can see the changes in the test file
  12. Created, in bash, a new vhost file (sudo vi Added a comment
  13. I was able to edit this file back in windows.
  14. In bash, sudo vi gave "Permissin denied" (in vi)
  15. In the Windows cmd shell renamed to host.conf
  16. In bash, ls still shows
  17. In bash, sudo vi host.conf works (says "[New File]")
  18. But attempts to save that file give an error: "E212: Can't open file for editing"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.