title:nmount - alternative mount keywords:linux,qemu,mount.linux, # nmount - alternative mount ## Intro So simple mount utility, to mount files and give params to mount syscall. ## Ideas Busybox needs /etc/fstab to work, minibase where using predefined locations. If this is all removed then its become portable tool. Minibase - https://github.com/arsv/minibase/blob/master/src/root/kmount.c Mount syscall - https://man7.org/linux/man-pages/man2/mount.2.html ```c #include int mount( const char* source, const char* target, const char* filesystemtype, unsigned long mountflags, const void* data); ``` Syscall looks pretty simple So comamnd looks simple to check with filesystems kernel supports check procfs /proc/filesystems Run: ``` cat /proc/filesystems ``` Output: ``` nodev sysfs nodev tmpfs nodev bdev nodev proc nodev cgroup nodev cgroup2 nodev cpuset nodev devtmpfs nodev binfmt_misc nodev configfs nodev debugfs nodev tracefs nodev securityfs nodev sockfs nodev bpf nodev pipefs nodev ramfs nodev hugetlbfs nodev devpts nodev autofs nodev mqueue nodev pstore ext3 ext2 ext4 nodev vboxsf vfat fuseblk nodev fuse nodev fusectl ``` ## Use Currently help is supproted for procfs,devtmpfs and sysfs. Next to add is ext4 ``` #mount proc nmount_static -v -t proc -d /Process -f nosuid,nodev,noexec,realtime #mount dev nmount_static -v -t devtmpfs -d /Devices -f nosuid #mount sys nmount_static -v -t sysfs -d /System -f nosuid,nodev,nosuid,realtime #mount ext4 #mount mqueue nmount_static -v -t mqueue -d /Queue -f rw,nodev,nosuid,realtime #mount tmpfs nmount_static -v -t tmpfs -d /Ram -f rw,nodev,nosuid,realtime ``` available options ``` Usage: ./nmount [OPTS] Version: 0.0.1 -s source directory -d target directory -t filesystem type -f mount flags -o mount fs options -v verbose output -h help options -a helper for filetype options ``` output help thats shows all availiable options, for fs ``` ./nmount -f proc -a devtmpfs /Device mqueue /Queue/ proc /Process hidepid=%u 0 Everybody may access all proc 1 User can access only their own proc, not other /proc/[pid] 2 As for mode 1, extra hides pid directories of others gid=%u user group that can access process gid usergroup who sees /proc in mode 0 tmpfs /Ram sysfs /System ext4 (null) ext3 (null) ext2 (null) vfat (null) msdos (null) ntfs (null) ``` Its create directory if its not excist ## Source http://git.main.lv/cgit.cgi/nmount.git/ Compile: ``` make ``` create one dynamic and one static binary ## Links https://man7.org/linux/man-pages/man2/mount.2.html https://github.com/arsv/minibase/blob/master/src/root/kmount.c