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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
11-25-2009, 08:40 PM
|
#1
|
Member
Registered: Jan 2008
Posts: 258
Rep:
|
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
|
|
|
11-25-2009, 09:19 PM
|
#2
|
Senior Member
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290
|
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.
|
|
|
11-25-2009, 09:22 PM
|
#3
|
LQ Guru
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 27,141
|
Quote:
Originally Posted by elainelaw
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
|
|
|
11-29-2009, 09:02 PM
|
#4
|
Member
Registered: Jan 2008
Posts: 258
Original Poster
Rep:
|
Quote:
Originally Posted by TB0ne
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
|
|
|
11-29-2009, 09:25 PM
|
#5
|
LQ Guru
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,726
|
Quote:
Originally Posted by elainelaw
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.
|
|
|
11-30-2009, 09:39 AM
|
#6
|
LQ Guru
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 27,141
|
Quote:
Originally Posted by evo2
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...
|
|
|
11-30-2009, 08:25 PM
|
#7
|
Member
Registered: Jan 2008
Posts: 258
Original Poster
Rep:
|
Quote:
Originally Posted by TB0ne
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
|
|
|
11-30-2009, 08:30 PM
|
#8
|
LQ Guru
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 27,141
|
Quote:
Originally Posted by elainelaw
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.
|
|
|
All times are GMT -5. The time now is 01:18 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|