Re: notice on accepted ssh login - howto?



mousomer <mousomer@xxxxxxxxx> wrote:
On Jun 17, 2:55 pm, "C." <colin.mckin...@xxxxxxxxx> wrote:
On Jun 16, 7:10 pm, mousomer <mouso...@xxxxxxxxx> wrote:

I need some help. I run a mandriva linux (2008). I need a notice
(popup preferred) whenever a (certified) user logs in to my computer.
I need a real-time notice. How do I do it?
And I don't intend on having cron running every 10 seconds.
thanks

Something like....

#!/bin/bash

tail -f /var/log/security | awk "
/whatever a ssh login looks like/ {
print | `xdialog --title "SSH login" --msgbox "User $4 has logged
in"

}"

Notes
- not tested - you'll need to change $4 in the above to wherever the
username appears
- you'll need to work on Xauth and xhost if the program is to run in a
seperate session from your X server.

C.

That's very nice, but I need a notice to pop real-time when another
user logs in. I already know where to look for the log lost.
"who -a" does the job best, also there's a nice Mandriva piece of code
which sends warnings to console 12. But I want an automatic warning to
popup when someone else logs in - without having to run a script every
10 minutes.

I haven't tried it, but this should do what you want! The "tail -f"
specifies *continous* following of the log file. Whenever a line comes
up that matches the ssh login (containing the username), you get a match
-- of course ONLY when the file is actually written, and the "tail -f"
reads it and passes it along. That, in turn, pops up your GUI dialog.

Seems simple enough.

An alternate would be to replace the user's shell (or startup profile).
You could simply change the ownership of .bashrc to "root" and disallow
local writes. The last line of .bashrc can then test for (say)
..bashrc_local and run that.

Within the .bashrc, put the xdialog (or whatever popup notification you
want).



.



Relevant Pages

  • Re: Windows XP logon/logoff loop
    ... I have inspected the eventvwr logs on the pc. ... If you're able to login from Safe Mode, then the problem is not related to ... When I try to log on it shows me a blank yes/no popup ... When I choose safe mode with network support or a normal boot I have ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: post nimda antivirus defs error mssg
    ... | I have a user that is getting an error after he logs in. ... | runs the network logon scripts, he gets a popup that states Your PC ... Compeltelely insufficient information! ...
    (microsoft.public.security.virus)
  • post nimda antivirus defs error mssg
    ... I have a user that is getting an error after he logs in. ... runs the network logon scripts, he gets a popup that states Your PC ... I've google the heck out of this but can't seem to find any good info. ...
    (microsoft.public.security.virus)
  • Re: Tracking the time of a user!
    ... If you enable auditing of "account logons" in Domain Controller Security ... Policy" it will display only the time a user logs onto the domain. ... > his time when he logs on and recording the logon and the logoff time. ...
    (microsoft.public.win2000.group_policy)
  • RE: Cant login to server via Terminal until reboot of server
    ... occurs even when only 1 user logs in. ... > The client could not establish a connection to the remote computer. ...
    (microsoft.public.windows.terminal_services)