this post was submitted on 03 Nov 2024
14 points (93.8% liked)

Selfhosted

60734 readers
115 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

Detailed Rules Post

  1. Be civil.

  2. No spam.

  3. Posts are to be related to self-hosting.

  4. Don't duplicate the full text of your blog or readme if you're providing a link.

  5. Submission headline should match the article title.

  6. No trolling.

  7. Promotion posts require active participation, with an account that is at least 30 days old. F/LOSS without a paywall has exceptions, with requirements. See the rules link for details. Tags [CBH] or [AIP] are required, see the links in Rule 8 for details.

  8. AI-related discussions and AI-involved promotional posts have additional requirements for tagging, as noted in Rule 7 and the AI & Promotional Post Expanded Rules post, and find example disclosures here.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 3 years ago
MODERATORS
 

Hi everyone! I want to be able to access a folder inside the guest that corresponds to a cloud drive that is mounted inside the guest for security purposes. I have tried setting up a shared filesystem inside Virt-Manager (KVM) with virtiofs (following this tutorial: https://absprog.com/post/qemu-kvm-shared-folder) but as soon as I mount the folder in order for it to be accessible on the ~~guest~~ host the cloud drive gets unmounted. I guess a folder cannot have two mounts at the same time. Aliasing the folder using bind and then sharing the aliased folder with the host doesn't work either. The aliased folder is simply empty on the host.

Does anyone have an idea regarding how I might accomplish this? Is KVM the right choice or would something like docker or podman better suited for this job? Thank you.

top 18 comments
sorted by: hot top controversial new old
[–] Appoxo@lemmy.dbzer0.com 7 points 2 years ago (3 children)

Maybe NFS share the drive from guest to host?

[–] Atherel@lemmy.dbzer0.com 2 points 2 years ago (1 children)

This, had the same idea for other purposes, sharing a folder from vm to host through network share is the easiest way. Every other solution looks more elegant on paper but has lots of pitfalls.

[–] GathererStuff@lemmy.ml 1 points 2 years ago* (last edited 2 years ago)

Every other solution looks more elegant on paper but has lots of pitfalls

A very sane and fair comment.

[–] GathererStuff@lemmy.ml 1 points 2 years ago (1 children)

I can try but I might end up in the same situation as with virtiofs. The cloud drive will get unmounted and I will end up with an empty folder when I try to access it from the host.

[–] wildbus8979@sh.itjust.works 2 points 2 years ago (1 children)

Absolutely not, NFS is a shared mount. Virtiofs is more complicated because it is emulating a block device.

[–] GathererStuff@lemmy.ml 1 points 2 years ago

Then I will try NFS and get back to you. Thanks :)

[–] GathererStuff@lemmy.ml 1 points 2 years ago (1 children)

What would be the performance implications? Isn't virtiofs theoretically faster?

[–] Appoxo@lemmy.dbzer0.com 2 points 2 years ago (1 children)

Not an expert.
Assuming it's internal I'd assume it's probably as fast as the guest nic allows?

[–] GathererStuff@lemmy.ml 1 points 2 years ago

Fair. I will try NFS if anything else fails. Thanks :)

[–] DetachablePianist@lemmy.ml 2 points 2 years ago (1 children)

Maybe see if 'rclone mount' solves the problem for ya. Rclone can often be a super handy swiss army knife for stuff like this.

[–] GathererStuff@lemmy.ml 1 points 2 years ago

The cloud binary is proprietary and it's not supported by rclone unless I find out how the binary works but I doubt it uses something standardized like WebDAV underneath.

[–] NeoNachtwaechter@lemmy.world 1 points 2 years ago* (last edited 2 years ago) (1 children)

You say it is mounted. Then you can share it in all the same ways as you would share any other of the VM's folders.

I am using SMB shares for that (but that is not always the best way ofc).

[–] GathererStuff@lemmy.ml 1 points 2 years ago

The cloud drive is mounted on the guest, yes, but once I mount it with virtiofs in order to share it with the host it gets unmounted and I end up with an empty folder. bind doesn't work either.

[–] possiblylinux127@lemmy.zip 0 points 2 years ago (1 children)

You don't

That is going to be painful and not beneficial

[–] GathererStuff@lemmy.ml 1 points 2 years ago (1 children)

I strongly disagree why this would not be beneficial. Could you expand?

[–] possiblylinux127@lemmy.zip 2 points 2 years ago (1 children)

You will need to mange the VM separately and the added hop (into the VM and then out again) will slow down performance and create another point of failure.

Why would running it in a VM benefit security? Couldn't you just mount it with fuse?

[–] GathererStuff@lemmy.ml 2 points 2 years ago (1 children)

Because the executable is proprietary (and a bit legacy I would say) and full of telemetry, undocumented and the cloud service has no CLI, WebDAV or rclone support. I do not want to run something like that on my personal computer and I do not know how to use bwrap properly and don't want to risk it. I have since switched over to a podman container but I encounter the same problem, the folder is empty on the host (See my post here: https://lemmy.ml/post/22215540).

[–] S_S@lemy.lol 1 points 2 years ago

I've used bubblewrap for many things and for a long time now, if you want to try that and have questions about it I think I can help, it is what I should have done in your scenario and what I have done much for the same reasons