I am able to connect to my webdav server via Pantheon but I would like to be able to access it permanently and directly, even after reboot. Currently, it does not remember the connection and I have to establish the connection every time. Is there a way around it? Found this Pantheon-files: network server not showing after reboot but I could not understand the procedure (and I don't have enough reputation to comment on it yet, sorry about that).
I used the instructions here to get mine working How to mount WebDAV share using systemd. It's important to pay attention to the names of the .mount and .automount services you'll have to create, which MUST correspond to the paths of the mountpoint folders. For example: creating a mount-my-webdav.mount unit will try to mount your WebDAV share to /mount/my/webdav... it will create the folder if it does not exist :)
Although it is not obligatory for this to work, you'll also have to create a new fstab entry if you want for the mounted folder to appear in the Devices section of Pantheon Files.
I will add below the steps I took, and the contents of my files, just as a guide:
Create a mountpoint folder:
sudo mkdir /media/vlad/Digi
Install the davfs package:
sudo apt get install davfs2
Add your WebDAV server configuration to the davfs secrets file:
sudo nano /etc/davfs2/secrets
and paste at the end a line something like this:
"https://webdav.server/share/path" webdav_user "webdav_password"
Create a new .mount service, with the name of the service reflecting the mount folder path from 1:
sudo nano /etc/systemd/system/media-vlad-Digi.mount
with the following contents:
[Unit] Description=Mount personal WebDAV After=network-online.target Wants=network-online.target [Mount] What="https://webdav.server/share/path" Where=/media/vlad/Digi Options=noauto,user,uid=vlad,gid=vlad Type=davfs TimeoutSec=60 [Install] WantedBy=remote-fs.target
- Create a new .automount service:
sudo nano /etc/systemd/system/media-vlad-Digi.automount
containing:
[Unit] Description=Automount personal WebDAV After=network-online.target Wants=network-online.target [Automount] Where=/media/vlad/Digi TimeoutIdleSec=300 [Install] WantedBy=remote-fs.target
Reload systemd manager configuration:
sudo systemctl daemon-reload
Enable the services:
sudo systemctl enable media-vlad-Digi.mount
sudo systemctl enable media-vlad-Digi.automount
Create e fstab entry for your new mount folder:
sudo nano /etc/fstab
and add a new line like this one:
https://webdav.server:443/share/path /media/vlad/Digi davfs user,noauto 0 0
Verify it all works well:
sudo systemctl start media-vlad-Digi.automount
sudo systemctl status media-vlad-Digi.mount
● media-vlad-Digi.mount - Mount personal WebDAV Loaded: loaded (/etc/systemd/system/media-vlad-Digi.mount; enabled; vendor preset: enabled) Active: active (mounted) since Thu 2019-12-12 22:04:08 EET; 18min ago Where: /media/vlad/Digi What: https://webdav.server:443/share/path Process: 3532 ExecUnmount=/bin/umount /media/vlad/Digi -c (code=exited, status=0/SUCCESS) Process: 3865 ExecMount=/bin/mount "https://webdav.server:443/share/path" /media/vlad/Digi -t davfs -o user,uid=vlad,gid=vlad Tasks: 1 (limit: 4915) CGroup: /system.slice/media-vlad-Digi.mount └─3867 /sbin/mount.davfs "https://webdav.server:443/share/path" /media/vlad/Digi -o rw noexec nosuid nodev uid=1000 g
- Reboot & Enjoy!
IMPORTANT:
In the commands above replace
vlad
with you user name, obviously, andhttps://webdav.server:443/share/path
with your WebDAV server's domain and pathIf, after reboot you find yourself staring at a black screen, with some white text, it means the fstab entry contains some errors. Press Ctrl + D followed by
nano /etc/fstab
. Comment the line you added at step 8 by placing a#
at it's beginning and reboot.When using the nano editor, use Ctrl + O to save the file, and Ctrl + X to exit nano.
You must run
sudo systemctl daemon-reload
after editing the .mount and .automount files.Depending on the speed of your network adapters, you might sometimes find that your WebDAV share appears twice in Files, under Devices. If it bothers you too much, comment the entry you added in fstab.
-
1Wow. I am amazed by your answer. It works perfectly and you are also very pedagogical. That's wonderful. Thanks a lot! (Sadly I cannot upvote you yet). – Plussoyeur Dec 13 '19 at 14:25
-
Glad I could help! One last think: at step 5, the
TimeoutIdleSec=300
means that the mount will disconnect automatically if there is no activity for 300 seconds. Set that value to 0 to keep it always connected. – Vlad Dec 13 '19 at 14:43 -
1Ok ok thanks. I don't really notice it because I guess it connects automatically when I click on the folder now. – Plussoyeur Dec 13 '19 at 15:02
-
Alternatively: connect once through files. Then when in the mounted webdav drive, right-click -> bookmark. You now have it as a bookmark and it will mount when you click it, prompting for credentials according to your settings. – rasmus91 Dec 13 '19 at 15:47