Skip to content

Commit 9a904d5

Browse files
authored
Merge pull request #4968 from mie313/modify_sshfs_settings
Add Apparmor's fusermount3 custom rule for reverse SSHFS
2 parents d668579 + b18cf05 commit 9a904d5

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

pkg/cidata/cidata.TEMPLATE.d/boot.Linux/35-setup-packages.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,18 @@ update_fuse_conf() {
1616
echo "user_allow_other" >>"${fuse_conf}"
1717
fi
1818
fi
19+
20+
# Some distribution (since Ubuntu-25.04) has an apparmor rule for fusermount3. It causes SSHFS mount failed.
21+
# Related Issue: https://github.com/lima-vm/lima/issues/4908
22+
# Therefore, define a custom rule to loosen the apparmor rule.
23+
if [ -e "/etc/apparmor.d/fusermount3" ] && [ ! -e "/etc/apparmor.d/local/fusermount3" ]; then
24+
cat >"/etc/apparmor.d/local/fusermount3" <<EOF
25+
# The following two lines allow VM to be mounted to / unmounted from home directly.
26+
mount fstype=@{fuse_types} options=(nosuid,nodev) options in (ro,rw,noatime,dirsync,nodiratime,noexec,sync) -> @{HOME},
27+
umount @{HOME},
28+
EOF
29+
apparmor_parser -r /etc/apparmor.d/fusermount3
30+
fi
1931
}
2032

2133
# update_fuse_conf has to be called after installing all the packages,

0 commit comments

Comments
 (0)