PAM_ALREADYLOGGEDIN(8)
π PAM_ALREADYLOGGEDIN π
okay bestie, welcome to pam_alreadyloggedin β the Already-logged-in PAM module, straight out of the System Manager's Manual, section 8. pull up a chair, we're gonna vibe with authentication π
β¨ NAME β¨
pam_alreadyloggedin β the Already-logged-in PAM module. that's it, that's the name, iconic behavior fr fr π
πΈ SYNOPSIS πΈ
[service-name] module-type control-flag pam_alreadyloggedin [options]
look at that. so simple. so clean. the way she just slots into your PAM config ππ
π¦ DESCRIPTION π¦
so, pam_alreadyloggedin is the Already-logged-in authentication service module for PAM. she provides functionality for only one PAM category: authentication. in terms of the module-type parameter, that's the "auth" feature. and for all the other PAM categories? she gives you null functions. basically she shows up, does her one job, and does not overextend herself. boundaries! we love to see it π
π Already-logged-in Authentication Module π
the Already-logged-in authentication component β that's pam_sm_authenticate() β returns success if and only if the target user's ID is identical to a current login specified in the utmp(5) database and verified with matching permissions on that login's respective terminal in /dev. periodt, no cap.
and like, the vibe check here is: if a user shows up in w(8) output, they will generally be allowed to authenticate using this method. slay π«Ά
the following options may be passed to the authentication module:
debugβ turn on verbose output to syslog atLOG_DEBUGlevel. she's gonna talk, bestie.no_debugβ turn off verbose output to syslog, even when it's enabled at compile time. shhh. π€«no_rootβ never ever allow login with a target user ID of zero. protect the root account, she's sacred πrestrict_tty=*ttyglob** β only allow login if the terminal device currently being authenticated on matches *ttyglob**. the *ttyglob** argument is specified as a shell glob, and checked using thefnmatch(3)function. for example,restrict_tty=/dev/tty[1-6]allows logging from text consoles of physical terminal only. very specific. very demure. πrestrict_loggedin_tty=*ttyglob** β disallow recognition that the user is already logged in unless the terminal device logged in upon matches *ttyglob**. yes, the globs are different jobs, don't get it twisted π
β EXAMPLE β
modify the auth section of the /etc/pam.d/login file like the following:
auth required /lib/security/pam_securetty.so
auth sufficient /lib/security/pam_alreadyloggedin.so no_root
auth required /lib/security/pam_stack.so service=system-auth
see how she's sitting in there with sufficient? main character energy, no notes π₯
π BUGS π
okay so this is the part where we get a lil messy, and you need to hear me out:
the FreeBSD version expects the/dev/prefix in therestrict_ttyvalue, but the value ofrestrict_loggedin_ttyshould be without them. the Linux version expects/dev/in both cases.
not me having to read that twice π it's giving "portability was not the priority". just. remember which platform you're on, bestie. that's all I'm saying. π
π SEE ALSO π
fnmatch(3), getuid(2), stat(2), utmp(5), w(8), pam.conf(5), pam(8)
the whole friend group. go read them, they're all lowkey useful π§
π AUTHORS π
adopted for Linux PAM by Ilya Evseev at Jan 2004. thank you for your service, king π«Ά
the original pam_alreadyloggedin module and this manual page were developed for the FreeBSD Project by NAI Labs and ThinkSec AS, the Security Research Division of Network Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the DARPA CHATS research program. academia said "we're gonna build authentication infrastructure" and honestly? they ate π
and that's the whole page, bestie!! πΈ this was Linux-PAM, dated January 30, 2004 β yeah she's an elder but she's still serving, and she lives in the PAM_ALREADYLOGGEDIN(8) chapter of the System Manager's Manual forever π mwah, go configure something β¨π
π¦ where this page comes from
- debian bookworm: libpam-alreadyloggedin 0.3-12 Β· BSD-3-Clause
- ubuntu jammy: libpam-alreadyloggedin 0.3-10 Β· BSD-3-Clause
- ubuntu noble: libpam-alreadyloggedin 0.3-14 Β· BSD-3-Clause
- ubuntu questing: libpam-alreadyloggedin 0.3-14
- Copyright (c) 2002 Brian Fundakowski Feldman
- Copyright (c) 2002 Networks Associates Technologies, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms