Slackware This Forum is for the discussion of Slackware Linux.
|
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.
|
|
04-18-2005, 12:32 AM
|
#1
|
Member
Registered: Oct 2004
Location: Rhode Island, USA
Distribution: Slackware... Simplicity is bliss.
Posts: 62
Rep:
|
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
|
|
|
04-18-2005, 01:38 AM
|
#2
|
Senior Member
Registered: Feb 2002
Location: Szczecin, Poland
Distribution: Gentoo, Debian
Posts: 2,458
Rep:
|
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
|
|
|
04-18-2005, 02:29 AM
|
#3
|
Member
Registered: Oct 2004
Location: Rhode Island, USA
Distribution: Slackware... Simplicity is bliss.
Posts: 62
Original Poster
Rep:
|
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
|
|
|
04-18-2005, 04:09 AM
|
#4
|
LQ Guru
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552
|
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>
|
|
|
04-20-2005, 12:21 PM
|
#5
|
Member
Registered: Oct 2004
Location: Rhode Island, USA
Distribution: Slackware... Simplicity is bliss.
Posts: 62
Original Poster
Rep:
|
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
|
|
|
04-20-2005, 12:36 PM
|
#6
|
LQ Guru
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552
|
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.
|
|
|
All times are GMT -5. The time now is 09:14 PM.
|
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
|
|