PAM_TMPDIR(8)

πŸ’– PAM_TMPDIR ✨

okay so bestie, welcome to pam_tmpdir(8) β€” straight out of the System Manager's Manual, no less πŸ‘‘. this one's a PAM module and it's lowkey iconic for one very specific reason, so let's get into it 🫢


🌸 NAME 🌸

pam_tmpdir β€” the PAM module that makes a secure directory for users' temporary files πŸ’…

πŸŽ€ SYNOPSIS πŸŽ€

pam_tmpdir.so

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the vibe: you can plug this module into the session stack of whatever service you want, and it hands out secure, per-user directories for temporary files. that's it, that's the whole personality. per-user, secure, temporary, slay ✨

πŸ’… OPTIONS πŸ’…

where do the users' temp dirs actually get made? you decide, bestie. you set it with an entry in /etc/security/tmpdir.conf:

tmpdir=/path/to/tmpdir
  • the default? it's /tmp/user β€” that's where it goes if you don't say otherwise πŸ’œ

πŸ‘‘ MODULE TYPES PROVIDED πŸ‘‘

so like, obviously this is meant to be used with the session module type β€” that's its whole moment. but it also provides account, auth, and password module types too. overachiever behavior fr fr πŸŽ€

⭐ RETURN VALUES ⭐

  • PAM_SUCCESS β€” yay!! the temporary directory was successfully created πŸŽ‰βœ¨
  • PAM_ABORT β€” uh oh. something went wrong while trying to create that temporary directory 😭
  • PAM_SERVICE_ERR β€” an internal error happened. not our fault, not your fault, it's just giving internal πŸ’€

🌈 EXAMPLES 🌈

1. let users log in even if pam_tmpdir fails to create a safe tmpdir:

session    optional     pam_tmpdir.so

2. deny login if an error occurs while setting up the safe tmpdir:

session    required     pam_tmpdir.so
NOTE: this could allow for a DoS attack if a malicious user creates /tmp/user before pam_tmpdir does. so like... be aware. this is the dramatic part. 🚨

🧚 SEE ALSO 🧚

πŸ“ AUTHOR πŸ“

Tollef Fog Heen <tfheen@err.no> πŸ’–

Copyright Β© 2002-2012 Tollef Fog Heen <tfheen@err.no>.

This is free software; see the source for copying conditions.

There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. (ngl that's the standard disclaimer but the caps lock is doing a LOT here 😭)


and that's the whole page bestie 🫢 this came from the System Manager's Manual, dated as PAM_TMPDIR(8) β€” so like, go forth and make secure temp dirs. periodt πŸ’…βœ¨

πŸ“¦ where this page comes from