Re: notice on accepted ssh login - howto?
- From: Fred Weigel <fred@xxxxxxxxxxxxxxxxxxx>
- Date: Tue, 17 Jun 2008 16:17:39 +0200 (CEST)
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).
.
- References:
- notice on accepted ssh login - howto?
- From: mousomer
- Re: notice on accepted ssh login - howto?
- From: C.
- Re: notice on accepted ssh login - howto?
- From: mousomer
- notice on accepted ssh login - howto?
- Prev by Date: Re: notice on accepted ssh login - howto?
- Next by Date: Re: notice on accepted ssh login - howto?
- Previous by thread: Re: notice on accepted ssh login - howto?
- Next by thread: Re: notice on accepted ssh login - howto?
- Index(es):
Relevant Pages
|