PAM_SECURETTY(8)

โœจ PAM_SECURETTY โœจ

okay bestie, gather round, because this one is literally about keeping root out of places it shouldn't be ๐Ÿ’… it lives in the Linux-PAM Manual and it's giving "bouncer at the club door, but for ttys".


๐ŸŒธ NAME ๐ŸŒธ

pam_securetty โ€” limit root login to special devices ๐ŸŽ€


๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

pam_securetty.so [debug]

๐Ÿ’– DESCRIPTION ๐Ÿ’–

so pam_securetty is a PAM module that lets root log in only if the user is logging in on a "secure" tty, and "secure" is defined by the listing in the securetty file. no cap, that's the whole vibe check ๐Ÿ‘‘

first thing it does, pam_securetty checks whether /etc/securetty exists. if it doesn't, and it was built with vendordir support, it will use /securetty instead. โœจ

pam_securetty also checks that the securetty files are plain files and not world writable โ€” because a world-writable securetty is a whole mess and we are not doing that ๐Ÿšซ

it will also allow root logins on the tty specified with the console= switch on the kernel command line, and on ttys from /sys/class/tty/console/active. iconic of it honestly.

this module has no effect on non-root users, and it requires that the application fills in the PAM_TTY item correctly. like, if the app doesn't hand over the tty properly, this whole thing is a no-op, so... do that ๐Ÿซถ

for canonical usage, it should be listed as a required authentication method before any sufficient authentication methods. order matters, bestie, it's not a suggestion ๐ŸŽ€


โญ OPTIONS โญ

  • debug โ€” print debug information. the receipts, the lore, all of it ๐Ÿ”
  • noconsole โ€” do not automatically allow root logins on the kernel console device, as specified on the kernel command line or by the sys file, if it is not also specified in the securetty file. so basically: if you want console logins to have to earn it by being in the securetty file, flip this on ๐Ÿ’…

๐ŸŒˆ MODULE TYPES PROVIDED ๐ŸŒˆ

only the auth module type is provided. that's it. that's the list. one and done ๐Ÿ‘‘


๐Ÿ’œ RETURN VALUES ๐Ÿ’œ

  • PAM_SUCCESS โ€” the user is allowed to continue authentication. either the user is not root, or the root user is trying to log in on an acceptable device. slay, we move ๐ŸŽ‰
  • PAM_AUTH_ERR โ€” authentication is rejected. either root is attempting to log in via an unacceptable device, or the securetty file is world writable or not a normal file. ๐Ÿšซ
  • PAM_BUF_ERR โ€” memory buffer error. the vibes ran out of RAM, basically ๐Ÿ˜ญ
  • PAM_CONV_ERR โ€” the conversation method supplied by the application failed to obtain the username. app fumbled the intro ๐Ÿ™ˆ
  • PAM_INCOMPLETE โ€” the conversation method supplied by the application returned PAM_CONV_AGAIN. it said "brb" ๐Ÿ’€
  • PAM_SERVICE_ERR โ€” an error occurred while the module was determining the user's name or tty, or the module could not open the securetty file. something broke mid-detective-work ๐Ÿ”ฅ
  • PAM_USER_UNKNOWN โ€” the module could not find the user name in the /etc/passwd file to verify whether the user had a UID of 0. therefore, the results of running this module are ignored. like, the module just shrugs and walks away ๐Ÿคทโ™€๏ธ

๐ŸŽ€ EXAMPLES ๐ŸŽ€

the canonical setup, copy it exactly bestie:

auth  required  pam_securetty.so
auth  required  pam_unix.so

see how pam_securetty.so comes first? that's the "required before any sufficient" thing we talked about. ate. ๐Ÿ’…


๐Ÿ”ฅ SEE ALSO ๐Ÿ”ฅ

securetty(5), pam.conf(5), pam.d(5), pam(8)


๐Ÿ‘‘ AUTHOR ๐Ÿ‘‘

pam_securetty was written by Elliot Lee <sopwith@cuc.edu>. ty for your service king ๐Ÿซถ


okay that's the whole page, bestie!! go forth and secure those ttys ๐ŸŒธ๐Ÿฆ‹ this was the Linux-PAM manual, dated 09/27/2026, and the page you just read is PAM_SECURETTY(8). mwah ๐Ÿ’–โœจ๐ŸŽ€

๐Ÿ“ฆ where this page comes from