VFS_SUSER(9)

πŸ’– VFS_SUSER πŸ’–

okay so bestie, welcome to vfs_suser(9) β€” the Kernel Developer's Manual page for checking if somebody's credentials have superuser privileges for a mount point ✨ this is kernel dev territory, so grab your iced coffee and let's go 🫢


🌸 NAME 🌸

vfs_suser β€” check if credentials have superuser privileges for a mount point πŸ‘‘


✨ SYNOPSIS ✨

#include <sys/param.h>
#include <sys/systm.h>
#include <sys/mount.h>

int
vfs_suser(struct mount *mp, struct thread *td);

literally just three includes and one function, we love a minimal entrance πŸ’…


πŸŽ€ DESCRIPTION πŸŽ€

so the vfs_suser() function checks if the credentials you handed it include superuser powers for the given mount point. it's giving "are you the moment or not" πŸ¦‹

here's the vibe check it runs: it looks at whether the thread you passed in has the same credentials as the user that mounted the file system. if yes β€” it returns 0 πŸŽ‰ otherwise it returns what priv_check(9) would have returned. no cap, that's the whole thing.


πŸ”₯ RETURN VALUES πŸ”₯

  • the vfs_suser() function returns 0 if the user has superuser powers πŸ’…
  • and EPERM otherwise πŸ’€
bestie, pay attention here β€” this is the reverse logic of some other implementations of suser() in which a TRUE response indicates superuser powers. so don't come in here thinking nonzero = yes. it's not that. πŸ™ˆ

🌈 SEE ALSO 🌈


⭐ HISTORY ⭐

the vfs_suser() function was introduced in FreeBSD 5.2. iconic era honestly πŸ‘‘


πŸ’œ AUTHORS πŸ’œ

this manual page was written by Alfred Perlstein. thank u king 🫢


okay and that's a wrap, bestie πŸŽ€ this little gem came out of the Debian corner of the world, dated April 2, 2004, and it lives under the VFS_SUSER(9) name. go forth and check those credentials βœ¨πŸ’–

πŸ“¦ where this page comes from