C
C
Caretaker2019-02-21 15:27:21
bash
Caretaker, 2019-02-21 15:27:21

How to catch logout event in time on debian?

Greetings.
The advice of experts on *NIX-am is required, and it is better specifically on DEBIAN.
There is a script that must be executed without fail for all users at the moment they exit the console, and there can be any exit method: from the correct "exit" in the console, to the banal "cross" of the SSH connection window.
I tried to bind to ~/.bash_logout - but it is executed only when the output is correct, it does not catch the "cross" option. In addition, it is individual for each user, but I would like to make a global edit so that everyone is affected without dancing with a tambourine.
Thanks in advance

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitsliputsli, 2019-02-21
@zuart

Use pam_exec.so:
1) add the following line to /etc/pam.d/sshd:
2) create an executable file /usr/bin/pam_ssh, the name of the event will be passed to the "$PAM_TYPE" variable.
Or just check the output of the last command from time to time. In principle, you can make a pipe listening daemon that is connected to add information to /var/log/wtmp, but you will need to configure the parsing of this log.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question