LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 04-18-2005, 12:32 AM   #1
gian2oo1
Member
 
Registered: Oct 2004
Location: Rhode Island, USA
Distribution: Slackware... Simplicity is bliss.
Posts: 62

Rep: Reputation: 15
Howto know each ssh users logs in at least every 24hrs


Hello! I frequently use different computers in different cities to work off (this cannot be changed) and I have them rsync everyday to one of my servers @ home. What I am trying to accomplish is a small admin webpage listing everyday my last sync and that my backup was successful. I was thinking maybe just dumping this data into an html file and using apache to view it via the http protocol. I created something similar to this that uses simple shell scripts to see if "backup_log" exists and then cross-checking it's date with todays date to see if it backed up today. BUT, I find sometimes a backup finished at 12:01 AM for say and my script things the back never happened (until tomorrow). Would it be better to check the backup_logs date with a 24 hour check thing? (Maybe in Perl, I don't know much perl, or can this be done via shell scripts?)

Or maybe grep through /var/log/messages for that users account ssh login crosschecked by there last login and make sure it hasn't been over 24 hours? (i'm using ssh to transfer the file via rsync). Do anyone know any scripts that may help me, or do you know a better way to accomplish this so i know every user i specify logs in every 24 hours at least via ssh? Again my main goal is knowing every PC logs in under 24 hours, so anyone suggestions would be appreciated if you think it would work.

Thanks for any help, i appreciate it.

-Gian Spicuzza
 
Old 04-18-2005, 01:38 AM   #2
peter_robb
Senior Member
 
Registered: Feb 2002
Location: Szczecin, Poland
Distribution: Gentoo, Debian
Posts: 2,458

Rep: Reputation: 48
I use the nail programme from within a user's .bashrc file
Every time they login, they send a very short email..

http://nail.sourceforge.net
 
Old 04-18-2005, 02:29 AM   #3
gian2oo1
Member
 
Registered: Oct 2004
Location: Rhode Island, USA
Distribution: Slackware... Simplicity is bliss.
Posts: 62

Original Poster
Rep: Reputation: 15
Dear peter_robb,

Thanks for the suggestion. After the daily backups, I would have a bunch of emails, correct? I was looking for something like a single webpage or a single email that would show all my users successful login instead of a few single emails. I'll look into nail and see if there are any options that may be useful, thank you very much for the suggestion.

-Gian
 
Old 04-18-2005, 04:09 AM   #4
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
Add -v to your rsync command and output result to a log file like :
Code:
00  12  *   *   *   rsync -e ssh -rzv server:/some/stuff /home/stuff > /home/sync.log 2>&1
Then download the sync.log file say at 12:30 with a crontab or if there is a web server
running on each machine with php, you could just do a php script :
PHP Code:
<pre>
<?php echo htmlentities(file_get_contents("/home/sync.log")); ?>
</pre>
 
Old 04-20-2005, 12:21 PM   #5
gian2oo1
Member
 
Registered: Oct 2004
Location: Rhode Island, USA
Distribution: Slackware... Simplicity is bliss.
Posts: 62

Original Poster
Rep: Reputation: 15
keefaz,

Thanks for the suggestion I'll look into that.

I also found when a user logs in, a line is added to /var/log/messages that looks like this:

Apr 20 00:20:29 oscar sshd[24257]: Accepted publickey for gian from 208.47.17.112 port 2034 ssh2

How about if I make a script that checks every 24 hours and crosschecks that date above to the last 24hours? Would that work? It seems pretty simple too. If that is suitable, would it be an easy script to write or would it be wise to hire a freelance programmer to draft it up?

Thanks for your suggestions I think I'm getting pretty far,

Gian Spicuzza
 
Old 04-20-2005, 12:36 PM   #6
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
There is also the w command with something like :
Code:
w -h | grep -v ' - '

Last edited by keefaz; 04-20-2005 at 12:40 PM.
 
  


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
tracing the logs from a dialup users nhoelle_18 Linux - Networking 0 06-01-2005 06:15 AM
howto Detect Intrusion without Logs aus9 Linux - Security 11 04-04-2005 07:08 AM
Logs users actions fargowiz Linux - Security 2 03-01-2005 04:04 AM
Users&Logs need help vgulch Linux - Software 0 11-30-2004 07:33 AM
Creating on the command logs for users aliwerd Linux - General 3 06-25-2003 07:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 12:50 AM.

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