Skip to content

Commit

Permalink
Add -o ro to davfs mount command
Browse files Browse the repository at this point in the history
  • Loading branch information
jwodder committed Aug 23, 2024
1 parent b23f124 commit 8f0d215
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
4 changes: 2 additions & 2 deletions WEBDAV.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ davfs2
the following commands with `sudo` without entering a password:

```
mount -t davfs https://webdav.dandiarchive.org /mnt/backup/dandi/dandisets-healthstatus/dandisets-fuse
mount -t davfs -o ro https://webdav.dandiarchive.org /mnt/backup/dandi/dandisets-healthstatus/dandisets-fuse
umount /mnt/backup/dandi/dandisets-healthstatus/dandisets-fuse
```

This can be done by adding the following lines to `/etc/sudoers`, where
`username` is replaced by the name of the user account:

```
username ALL=(ALL:ALL) NOPASSWD: /usr/bin/mount -t davfs https\://webdav.dandiarchive.org /mnt/backup/dandi/dandisets-healthstatus/dandisets-fuse
username ALL=(ALL:ALL) NOPASSWD: /usr/bin/mount -t davfs -o ro https\://webdav.dandiarchive.org /mnt/backup/dandi/dandisets-healthstatus/dandisets-fuse
username ALL=(ALL:ALL) NOPASSWD: /usr/bin/umount /mnt/backup/dandi/dandisets-healthstatus/dandisets-fuse
```

Expand Down
11 changes: 10 additions & 1 deletion code/src/healthstatus/mounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,16 @@ def mount(self) -> Iterator[None]:
log.debug("Mounting davfs2 mount ...")
self.mount_path.mkdir(parents=True, exist_ok=True)
subprocess.run(
["sudo", "mount", "-t", "davfs", DANDIDAV_URL, os.fspath(self.mount_path)],
[
"sudo",
"mount",
"-t",
"davfs",
"-o",
"ro",
DANDIDAV_URL,
os.fspath(self.mount_path),
],
check=True,
)
try:
Expand Down

0 comments on commit 8f0d215

Please sign in to comment.