diff options
| author | Mattias Andrée <maandree@operamail.com> | 2014-10-29 19:22:33 +0100 |
|---|---|---|
| committer | Mattias Andrée <maandree@operamail.com> | 2014-10-29 19:22:33 +0100 |
| commit | bb7c022b456c44df83023c1eb0671d83274ee236 (patch) | |
| tree | 185fda65a19363f007f24262a34a869fa8dfc7a3 | |
| parent | more code reuse (diff) | |
| download | cerberus-logging-bb7c022b456c44df83023c1eb0671d83274ee236.tar.gz cerberus-logging-bb7c022b456c44df83023c1eb0671d83274ee236.tar.bz2 cerberus-logging-bb7c022b456c44df83023c1eb0671d83274ee236.tar.xz | |
add support for ~/.prelogin
Signed-off-by: Mattias Andrée <maandree@operamail.com>
| -rwxr-xr-x | src/logging | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/logging b/src/logging index db14adb..14d2dfc 100755 --- a/src/logging +++ b/src/logging @@ -66,6 +66,7 @@ for arg in "$@"; do username="${arg}" fi done +user="${username}" # Execute a program only if it exists try () @@ -77,6 +78,17 @@ try () # Call logging programs (those that exists) for a successful login action log-login () { + # This is useful if you want to print the last logging. + # log-login-lastlog updates the entry in lastlog so it is helpful + # to be able to print the log entry before the is updated. Its lets + # you add a script named .prelogin in your home directory that + # contains the following code, to print the last login information: + # echo 'Last login:' ; lastlog --user $USER | tail -n 1 + script="$(getent passwd | grep '^${user}:' | cut -d : -f 6)/.prelogin" + if [ -x "${script}" ]; then + su -c "${script}" -- "${user}" + fi + try log-login-utmp "$@" try log-login-audit "$@" try log-login-lastlog "$@" |
