To implement a easy backup system in a PLC-application, we access a USB-Stick attached to an external Ubuntu-system. Therefore, the first attached USB-drive should be shared over Samba as soon as it gets attached.
The first attached USB always gets the path /dev/sdb. This dynamically mounted removable device should now always be shared with a fix name like "USB_DRIVE".
My problem is, that the drive is mounted with it's device description like "KENSINGTON". If the folder /media/KENSINGTON is shared, and the device gets removed and another Drive with the name "SCANDISK" is attached, it will not be shared.
So here are my questions:
- Is there a possibility to share a removable device with its path? So that always path /dev/sdb gets shared as soon as it is connected?
- I tried to bind a folder /mnt/USB_DRIVE to a specific mounted device like /media/KENSIGNTON. But the name of the folder in the media folder is not fixes. Can the name of the dynamically created folder /media/KENSINGTON be changed to the name of the path like /media/sdb'
- Is there another way to share the first attached usb-drive?
I'm aware of the security topics. The samba-shared folder is protected by a username and password.
A user should have the freedom to attach the stick he want to create a backup. So I cannot use the device name but need to determine the first one connected which has the path /dev/sdb/
/etc/fstab is definitely not working because the devices are dynamically plugged.
The best solution would be, if ubuntu would not mount the devices to the folder /media/ (Sample /media/Kensington) but with the path /media/ (Sample /media/sdb) Can it be configured somehow?
The usbmount tool seems to be a solution pointing into this direction. But as soon as it is installed, it generates the folders and they all remain empty, even if an usb-device is attached. What can be done wrong? Is it possible to configure the usbmount to create the folders usb[0-7] only when the specific device is attached and not permanently?