Setup automount using systemd
Install cifs, e.g. on Ubuntu:
1
sudo apt install cifs-utils
Create mount points, e.g.
1
sudo mkdir /mnt/iflglw
Create automount systemd service file. File name must match the mount point, e.g.:
1
sudo systemctl edit --full --force mnt-iflglw.automount
with following content:
1
2
3
4
5
6
7
8
9
10
[Unit]
Description=Automount IFL Group Share
ConditionPathExists=/mnt/iflglw
[Automount]
Where=/mnt/iflglw
TimeoutIdleSec=0
[Install]
WantedBy=multi-user.target
Enable and start the service via
1
2
sudo systemctl enable mnt-iflglw.automount
sudo systemctl start mnt-iflglw.automount
Create the mount systemd servive file:
1
sudo systemctl edit --full --force mnt-iflglw.mount
with content:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
[Unit]
Description=IFL Group Share
After=network-online.target
Wants=network-online.target
[Mount]
What=//vs-grp04.zih.tu-dresden.de/ifl
Where=/mnt/iflglw
Options=credentials=/home/stanley/Documents/keyfiles/tud.creds,uid=1000,gid=1000,iocharset=utf8,file_mode=0644,dir_mode=0755,noperm
Type=cifs
TimeoutSec=30
[Install]
WantedBy=multi-user.target
Finally, a credentials file (here: /home/stanley/Documents/keyfiles/tud.creds) has to be created with the following content:
1
2
3
user=
domain=
pass=