mount google drive inside Linux LXC container with samba shares

The requirement we had was to have a google drive accessible inside a samba share on our SME Server (from koozali.org). The google drive client for linux does not work properly in Centos 7 so here we mount it on the Rocky Linux 8 host to then give access to the LXC SME server container.

get the grive linux client

wget -O drive https://drive.google.com/uc?id=0B3X9GlR6EmbnMHBMVWtKaEZXdDg
mv drive /usr/local/sbin
chmod +X /usr/local/sbin/drive

make a mount point on the host and also bind mount it to the guest container

In our case below the ibay is called "data" and we made a subfolder inside there called gdrive so that all users of this share can also see the google drive and read/write to it.

mkdir ~/gdrivefs
drive (will give you a URL for an auth code)
gdfstool auth -a /var/cache/gdfs/credcache "YOURAUTHCODE"
gdfs -o allow_other /var/cache/gdfs/credcache ~/gdrivefs
mount --bind /root/gdrivefs /var/lib/libvirt/lxc/sme/rootfs/home/e-smith/files/ibays/data/files/gdrive

It's necessary to restart the guest LXC container since bind mounts are applied on boot. If your container is already running restart it after the bind mount on the host.

automate auth code on boot

will later add instructions to automount this on boot (including auth)

IT Support Contracts

Support contracts to cover all your IT and Telecoms with UK wide free call-out. Our friendly support staff provide on-site, telephone, email and remote support for workstations, servers, network infrastructure and phone systems. We offer support and consultation for firewalls, VPN, Linux server and deskop, MS and Mac server and desktop.

 

Linux Business Servers

Linux servers to suit every requirement from drop-in Microsoft replacements to advanced firewalls, high availability, thin client servers and virtualisation. Our SME Business Server product provides your business with an IT solution taking care of networking, security, storage, email, backup, remote access and much more.

 

Distro Support Includes

  • FusionPBX / Issabel / FreePBX
  • RedHat / Rocky / Alma
  • Koozali / smeserver / SUSE
  • Pfsense / Unix / BSD
  • Debian / Ubuntu / Linux Mint
  • Arch / Archbang / Gentoo
  • Fedora / Kubuntu / Xubuntu
  • Raspbian / Embedded Systems

Ubuntu Server & Desktop

Pre-configured Linux server, desktop and thin client systems to suit your requirements. We offer drop-in Microsoft Server replacements and even migrate your existing Microsoft server including large AD forests or migrations from Entra/Azure to self hosted Linux auth.