crc icon indicating copy to clipboard operation
crc copied to clipboard

CIFS/SMB based file sharing for windows

Open gbraad opened this issue 2 years ago • 3 comments

As a follow up to #3229 I would like to examine if the UFS server can run as part of the daemon process. Currently during tests it ran as a command, for which the server remains active until receiving a break.

gbraad avatar Jun 22 '22 14:06 gbraad

As we won't be able to use 9P on EL8 distros, looked at the windows default CIFS/SMB feature instead that can be enabled in the Windows Additional Features control, and did a ~2GB file copy to see the performance, which seems good..

[anjan@rhel8 ~]$ time cp ~/win-folder/Anjan/Downloads/Fedora-Workstation-Live-x86_64-35-1.2.iso /tmp

real    0m3.445s
user    0m0.005s
sys     0m0.942s
[anjan@rhel8 ~]$ du -sh /tmp/Fedora-Workstation-Live-x86_64-35-1.2.iso
1.9G    /tmp/Fedora-Workstation-Live-x86_64-35-1.2.iso

Steps to test:

  1. on the windows host we need to share a "folder" that will be mounted on the CRC VM
PS> New-SmbShare -Name "crc-vm" -Path "C:\Users\anath" -FullAccess "Everyone"
  1. Now mount this shared folder on the linux guest (UNC path will be //$hostname/crc-vm
$ sudo mount -t cifs //DESKTOP-H4H86J1/crc-vm ~/win-folder -o rw,uid=anjan,gid=anjan,username=guest,guest

NOTE: for the other (linux, macOS) platforms we mount the $HOME directory in the host on to /home/$(host_username), for windows we can do similar or use /c/users/$(host_username)

It does work and seems to have good performance, but it needs several privilege actions on the window host to enable the CIFS/SMB file sharing to work for us as we want it:

  1. Enabling the feature (can be handles by the msi or crc setup with reboot)
  2. Enabling "Password-less folder sharing", this is an UX issue because without it we need the windows current user password to mount the shared folder, so a user interaction is needed during crc start to request this info, while this can be enabled from the GUI, haven't yet found a way to automate this

anjannath avatar Aug 11 '22 08:08 anjannath

@adrianriobo shared this for a possible solution for pt. 2 https://mattmuster.com/2019/05/16/toggle-password-protected-sharing-on-windows-10/

anjannath avatar Aug 12 '22 08:08 anjannath

Created #3308 but decided to drop the idea of enabling password less share for the obvious reason of everyone getting access to the share if they can reach the machine, instead added a config option to set the "password" that'll be needed

anjannath avatar Aug 24 '22 08:08 anjannath

https://github.com/code-ready/crc/pull/3308#pullrequestreview-1126126666

Please make sure follow-up isses are created

This can be enabled by default as a password is required; this is unlike the use on linux and macos, or when 9p would be possible. We will have to look into this or instruct users what to do.

gbraad avatar Sep 30 '22 00:09 gbraad