LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-25-2009, 08:40 PM   #1
elainelaw
Member
 
Registered: Jan 2008
Posts: 258

Rep: Reputation: 30
Alert for user login


Can advise if I want to have a alert message when a specific user is login to the system , what can I do ? that mean if a specific is login to system then send me a alert message ( by any way ) to inform me the user is login , what is the method ? thanks
 
Old 11-25-2009, 09:19 PM   #2
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
Set up a program such as logwatch to monitor your system logs and send you an e-mail when a particular user logs in. This is probably the easiest way. There are a number of log monitoring programs available -- Google should help you out here.
 
Old 11-25-2009, 09:22 PM   #3
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by elainelaw View Post
Can advise if I want to have a alert message when a specific user is login to the system , what can I do ? that mean if a specific is login to system then send me a alert message ( by any way ) to inform me the user is login , what is the method ? thanks
Lots of ways.

- Put something in the users .bashrc, to send you a message.
- Put something in the system default profile, to check the user ID, and send you a message
- Use Logwatch or another logfile monitoring program, and look at the system logs, to see when that ID comes up
- Put something in cron to run a 'last' command periodically, and look for the ID, then send you a message
 
Old 11-29-2009, 09:02 PM   #4
elainelaw
Member
 
Registered: Jan 2008
Posts: 258

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by TB0ne View Post
Lots of ways.

- Put something in the users .bashrc, to send you a message.
- Put something in the system default profile, to check the user ID, and send you a message
- Use Logwatch or another logfile monitoring program, and look at the system logs, to see when that ID comes up
- Put something in cron to run a 'last' command periodically, and look for the ID, then send you a message

is this the easiest way ?

- Put something in the users .bashrc, to send you a message.

if use the way , what I need to add to ? thx
 
Old 11-29-2009, 09:25 PM   #5
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Quote:
Originally Posted by elainelaw View Post
is this the easiest way ?

- Put something in the users .bashrc, to send you a message.

if use the way , what I need to add to ? thx
I think putting it in the system profile and checking the UID is better since it is generally considered rude to modify users files. Also, unless you remove the users write permission they can simply remove your code.
Actually both of these approaches are a bit messy, I would recommend the logwatch approach.

Evo2.
 
Old 11-30-2009, 09:39 AM   #6
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by evo2 View Post
I think putting it in the system profile and checking the UID is better since it is generally considered rude to modify users files. Also, unless you remove the users write permission they can simply remove your code.
Actually both of these approaches are a bit messy, I would recommend the logwatch approach.

Evo2.
Yes, a bit messy, but effective, and easy to implement. Logwatch is a cleaner approach, but in my opinion, overkill....you'd have to set up logwatch, tell it what to look for, then write the script to take whatever action you want. The UID scan in the default profile is probably 4 lines of script....

And elainelaw, you asked
Quote:
is this the easiest way ?
- Put something in the users .bashrc, to send you a message.
if use the way , what I need to add to ? thx
They're all fairly easy...and you need to write your own shell scripts. We can't tell you what to add, since we don't know exactly what you need. You'll have to actually do this yourself. And please spell out your words...
 
Old 11-30-2009, 08:25 PM   #7
elainelaw
Member
 
Registered: Jan 2008
Posts: 258

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by TB0ne View Post
Yes, a bit messy, but effective, and easy to implement. Logwatch is a cleaner approach, but in my opinion, overkill....you'd have to set up logwatch, tell it what to look for, then write the script to take whatever action you want. The UID scan in the default profile is probably 4 lines of script....

And elainelaw, you asked

They're all fairly easy...and you need to write your own shell scripts. We can't tell you what to add, since we don't know exactly what you need. You'll have to actually do this yourself. And please spell out your words...
if I perfer to write a script , can give me a hints , how can I check whether the user is logging ? thx
 
Old 11-30-2009, 08:30 PM   #8
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by elainelaw View Post
if I perfer to write a script , can give me a hints , how can I check whether the user is logging ? thx
Again SPELL OUT YOUR WORDS..it's "thanks", not "thx"...

And I gave you hints in my first post, as did others on this thread. You can use the last command, put a command onto the user(s) bashrc, or check the user ID in the system profile, and do whatever you want from there.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Shutdown/restart alert at ssh login? smaddox Linux - Server 2 10-12-2009 12:46 AM
Quota alert via Wall for user via Cron snoopy1 Linux - Software 2 05-31-2009 07:49 PM
FC3 Red Hat Network Alert Icon dosnt work under user account animehair Fedora 3 11-17-2004 09:12 PM
Login Alert Mails Problem venkat_sde Linux - Newbie 2 08-28-2004 06:29 AM
Alert user password change ust Linux - Software 1 09-08-2003 05:09 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:28 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration