This post shows how to set up Samba access to part of the VM filesystem used by Crostini. In an earlier post on backups & restores I explained how to export a backup as a tarfile:
and this post shows how the exported tarfile can be easily moved to another machine for safekeeping.
First, with your default 'penguin' container started, add the '$LXD_CONF' directory as a disk in your container by entering the following command the VM or 'termina':
chmod o+w $LXD_CONF
lxc config device add penguin sambashare disk source=$LXD_CONF
path=/home/linuxiumcomau/sambashare
(note that the 'chmod' command is only necessary if you wish to write to the VM directory)
This will make '$LXD_CONF' accessible under your Linux files:
Next install the Samba package in your container 'penguin':
sudo apt install samba
and then configure the share drive:
sudo smbpasswd -a linuxiumcomau
sudo vi /etc/samba/smb.conf
by adding:
[sambashare]
comment = Samba Share
path = /home/linuxiumcomau/sambashare
valid users = linuxiumcomau
browseable = yes
read only = no
and then restart the Samba service:
sudo service smbd restart
and make a note of the container's IP address using 'hostname -I'.
You can optionally test that Samba is working by connecting as a Network File share:
Finally you need to add a forwarding rule to be able to access the Samba file share from an external machine on the same LAN as you Chrome device:
On your external machine you can now connect using 'Files' where you include the redirected port number with the IP address of your Chrome device:
or you can mount as a CIFS drive:
after which you can treat as part of your file system. For example in this scenario I took two screen shots on the external machine and then saved them on the '$LXD_CONF' drive and accessed them from Crostini:
Additionally I copied the 'eskimo.tar.gz' tarball to a local directory thus creating a external backup of my Crostini container.
Once finished simply un-mount as appropriate any instances of the Samba drive and remove it from the container by entering the following commands in your VM or 'termina':
lxc config device remove penguin sambashare
chmod o-w $LXD_CONF
(with the 'chmod' command only being necessary if you initially changed the permissions).
Please donate if you find this guide useful using the following link http://goo.gl/nXWSGf.
2 comments:
I cannot make this flow work. If the screen shots were hi res I might be able to puzzle it out.
Item: "You can optionally test that Samba is working by connecting as a Network File share"
in chromebook files app -> add new service -> smb file share I try 100.115.92.200\sambashare
no go
Any thoughts ?
If you "right click" on an image and then "Open link in a new tab" you should get a full screen image. Also make sure that "100.115.92.200" is the IP address of your container's IP address by using 'hostname -I'.
Post a Comment
All comments now moderated so that spam can be deleted.