How to Automount NTFS, EXT4, and FAT File Systems on FreeBSD and Allow Non-Root User Access
FreeBSD is a robust and versatile operating system that can be used to access a wide range of file systems, including NTFS, EXT4, and FAT. While FreeBSD has built-in support for these file systems, automounting them and granting non-root users access can be a challenge. In this post, we will provide a step-by-step guide on how to automount these file systems on FreeBSD and enable non-root users to access them.
Setup Mount
pkg install -y fusefs-exfat fusefs-ext2 fusefs-ntfs exfat-utils
echo 'vfs.usermount=1' | tee -a /etc/sysctl.conf
sysctl vfs.usermount=1
sysrc devfs_system_ruleset="localrules"
sysrc kld_list+="fusefs"
Add these lines to /etc/devfs.conf
:
[localrules=5]
add path 'da[1-3]p*' mode 0660 group operator
Done:
mount -t msdosfs -o -m=644,-M=755 /dev/da1p1 /media
Automount
USB devices can be automatically mounted by uncommenting this line below in /etc/auto_master
:
/media -media -nosuid
Edit `/etc/devd.conf
notify 100 {
match "system" "GEOM";
match "subsystem" "DEV";
action "/usr/sbin/automount -c";
};
And:
sysrc autofs_enable="YES"
service automount restart
service automountd restart
service autounmountd restart
service devd restart
More to read
or Use DSB
pkg install -y dsbmc dsbmc-cli
sysrc dsbmd_enable=YES
service dsbmd start
Mount:
dsbmc-cli -m /dev/da0s1