I have several folders on my NAS set to automount on my Xubuntu laptop at boot, using a saved credentials file. Each one has an fstab entry that looks like this:
# NAS home
//192.168.1.111/Home/ /home/username/mountpoint cifs credentials=/home/username/nas.creds,uid=1000,gid=1000 0 0
This works perfectly when the laptop is connected to Ethernet on boot. However if not (as will almost always be the case) then the shares fail to mount. They are still visible on the desktop/file manager but if I attempt to open them a message pops up that they can only be mounted by root.
If I then use sudo mount -a
then the shares mount as usual.
My understanding is that this happens because fstab is executed some time before a Wi-Fi connection to the network is established, meaning the mounts fail.
Adding sudo mount -a
to the startup apps won't work as it requires a password.
So, what is an appropriate method to ensure that the shares mount after a Wi-Fi connection is established?
Thanks!
/etc/network/if-up.d
and added the following:`#!/bin/sh
/bin/mount -a`
Didn't work on the first reboot, so I changed the permissions to make the file executable. After the next reboot, the shares were mounted!
Thanks again.
– 4n3wv Jul 18 '18 at 14:02