Score:1

Mount samba shared directory as user home folder on the guest virtual machine

uy flag

I want to run several Ubuntu 20.04 virtual machines based on libvirt that share the same home folder for the user. On the host I created the following samba shared folder:

lsblk
sdd                          8:48   0   1.9T  0 disk  
└─luks-46538...
                        253:2    0   1.9T  0 crypt 
└─data-ubuntu--gpu--home 253:10   0  1000G  0 lvm   /mnt/shared_home

on the host I created the group editors to make them access shared folders following this guide How to create a Samba share on Ubuntu Server 20.04.

From /etc/samba/smb.conf

[AABOR-HOME]
    comment = aabor-samba-home
    path = /mnt/shared_home/aabor
    valid users = @editors
    browsable = yes
    writable = yes
    read only = no
[MEDIA]
    comment = aabor-samba-media
    path = /mnt/media
    valid users = @editors
    browsable = yes
    writable = yes
    read only = no        

then on the VM guest I add to /etc/fstab

//192.168.0.5/aabor-home                  /home/aabor     cifs    rw,relatime,cache=strict,username=aabor,password=<pwd>,domain=WORKGROUP,gid=1000,uid=1000  0 0
//192.168.0.5/media                       /mnt/media     cifs    rw,relatime,cache=strict,username=aabor,password=<pwd>,domain=WORKGROUP,gid=1000,uid=1000  0 0

The host is Centos Stream 8, so I also have to adjust SELinux permissions (on the host):

sudo setsebool -P samba_export_all_ro=1 samba_export_all_rw=1
getsebool -a | grep samba_export
sudo semanage fcontext -at samba_share_t "/mnt/shared_home(/.*)?"
sudo restorecon /mnt/shared_home
sudo semanage fcontext -at samba_share_t "/mnt/media(/.*)?"
sudo restorecon /mnt/media

Both shares are available on the guest, I can browse and change the files.

But when I change any system settings it can't be saved into user profile. Ubuntu does not saves into current user profile the power management, fonts and any other settings. For example, when I try to set nemo as default file manager I get errors:

(nemo:4537): dconf-WARNING **: 13:17:15.032: failed to commit changes to dconf: GDBus.Error:org.gtk.GDBus.UnmappedGError.Quark._g_2dfile_2derror_2dquark.Code2: Failed to rename file “/home/aabor/.config/dconf/user.0WKTV1” to “/home/aabor/.config/dconf/user”: g_rename() failed: Permission denied

What is appropriate way to set up samba share on the host if I intend to use it as user's home directory on several guest machines?

in flag
Are the Ubuntu guests running simultaneously? Or are you running them one at a time?
Alexander avatar
uy flag
I run them one at a time.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.