Skip to content

Add Apparmor's fusermount3 custom rule for reverse SSHFS#4968

Merged
AkihiroSuda merged 1 commit into
lima-vm:masterfrom
mie313:modify_sshfs_settings
May 14, 2026
Merged

Add Apparmor's fusermount3 custom rule for reverse SSHFS#4968
AkihiroSuda merged 1 commit into
lima-vm:masterfrom
mie313:modify_sshfs_settings

Conversation

@mie313
Copy link
Copy Markdown
Contributor

@mie313 mie313 commented May 12, 2026

Add a fusermount3 custom rule so that limactil can mount user's home directory using reverse SSHFS.

Related Issue: #4908

@mie313 mie313 force-pushed the modify_sshfs_settings branch from f19caa6 to 296bc99 Compare May 12, 2026 23:16
@mie313 mie313 marked this pull request as ready for review May 12, 2026 23:48

# Some distribution (for example Ubuntu-25.10) has an apparmor rule for fusermount3. It causes SSHFS mount failed.
if [ -e "/etc/apparmor.d/fusermount3" ]; then
cat >"/etc/apparmor.d/local/fusermount3" <<EOF
Copy link
Copy Markdown
Member

@AkihiroSuda AkihiroSuda May 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file shouldn't be overwritten if it already exists

Copy link
Copy Markdown
Contributor Author

@mie313 mie313 May 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your review.
I modified the code to append new lines (>>) so that local/fusermount3 is not overwritten even if it already exists.

# Some distribution (for example Ubuntu-25.10) has an apparmor rule for fusermount3. It causes SSHFS mount failed.
if [ -e "/etc/apparmor.d/fusermount3" ]; then
cat >"/etc/apparmor.d/local/fusermount3" <<EOF
mount fstype=@{fuse_types} options=(nosuid,nodev) options in (ro,rw,noatime,dirsync,nodiratime,noexec,sync) -> @{HOME},
Copy link
Copy Markdown
Member

@AkihiroSuda AkihiroSuda May 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment to explain what it does

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added comments to both the shell script file and local/fusermount3 file to be created.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now the file grows on every boot

# The following two lines allow VM to be mounted to / unmounted from home directly.
mount fstype=@{fuse_types} options=(nosuid,nodev) options in (ro,rw,noatime,dirsync,nodiratime,noexec,sync) -> @{HOME},
# The following two lines allow VM to be mounted to / unmounted from home directly.
mount fstype=@{fuse_types} options=(nosuid,nodev) options in (ro,rw,noatime,dirsync,nodiratime,noexec,sync) -> @{HOME},
# The following two lines allow VM to be mounted to / unmounted from home directly.
mount fstype=@{fuse_types} options=(nosuid,nodev) options in (ro,rw,noatime,dirsync,nodiratime,noexec,sync) -> @{HOME},
[...]

@mie313 mie313 force-pushed the modify_sshfs_settings branch 2 times, most recently from 3804e23 to 304d0ac Compare May 13, 2026 17:54
fi

# Some distribution (for example Ubuntu-25.10) has an apparmor rule for fusermount3. It causes SSHFS mount failed.
# Therefore, define a custom rule to loosen the apparmor rule.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add the URL of the issue in the code comment

fi
fi

# Some distribution (for example Ubuntu-25.10) has an apparmor rule for fusermount3. It causes SSHFS mount failed.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe (please confirm)

Suggested change
# Some distribution (for example Ubuntu-25.10) has an apparmor rule for fusermount3. It causes SSHFS mount failed.
# Some distribution (since Ubuntu-25.04) has an apparmor rule for fusermount3. It causes SSHFS mount failed.

@AkihiroSuda AkihiroSuda added this to the v2.1.2 milestone May 14, 2026
@mie313 mie313 force-pushed the modify_sshfs_settings branch from 304d0ac to 1da09e1 Compare May 14, 2026 07:02
Signed-off-by: mie313 <mie313.tanaka@gmail.com>
@mie313 mie313 force-pushed the modify_sshfs_settings branch from 1da09e1 to b18cf05 Compare May 14, 2026 07:13
Copy link
Copy Markdown
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@AkihiroSuda AkihiroSuda merged commit 9a904d5 into lima-vm:master May 14, 2026
61 of 62 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants