diff options
author | FreeArtMan <dos21h@gmail.com> | 2020-07-08 20:05:24 +0100 |
---|---|---|
committer | FreeArtMan <dos21h@gmail.com> | 2020-07-08 20:05:24 +0100 |
commit | 2e5ab9d3d7919ef7fe0e82cc61b142fb454d81cd (patch) | |
tree | 840bf80da8cd3749d23a59fde91980a30783576c /md/notes/xos/nmount.md | |
parent | 481fdc1a3c7411d1dba3c7fcbfc40b40110827e4 (diff) | |
download | md-content-2e5ab9d3d7919ef7fe0e82cc61b142fb454d81cd.tar.gz md-content-2e5ab9d3d7919ef7fe0e82cc61b142fb454d81cd.zip |
Added nmount notes
Diffstat (limited to 'md/notes/xos/nmount.md')
-rw-r--r-- | md/notes/xos/nmount.md | 135 |
1 files changed, 134 insertions, 1 deletions
diff --git a/md/notes/xos/nmount.md b/md/notes/xos/nmount.md index 7c3ed8d..8cfca03 100644 --- a/md/notes/xos/nmount.md +++ b/md/notes/xos/nmount.md @@ -1,4 +1,137 @@ title:nmount - alternative mount keywords:linux,qemu,mount.linux, -# nmount - alternative mount
\ No newline at end of file +# 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 <sys/mount.h> + +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 + +``` +nmount_static -v -t proc -d /Process -f nosuid,nodev,noexec,realtime +nmount_static -v -t devtmpfs -d /Devices -f nosuid +nmount_static -v -t sysfs -d /System -f nosuid,nodec,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 /MQueue/ +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) +vfat (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 |