LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 07-15-2011, 06:02 AM   #1
wagmare
Member
 
Registered: Jan 2009
Posts: 62

Rep: Reputation: 15
notification of SSH login


hi friends,

i am having the problem of rebooting the system when some one is login to my PC. most of the time i will be checking with who command but sometimes i rebooting it which other logins lost their datas.
so is there any notification in linux when some person login to my PC using SSH or remote login .
i tried notify-send script but failed to connect with SSH.
notify-send "SSH login"
can any one please help me with this ..
if any one login to my PC just one notification i required in my desktop.


thanks in advance
 
Old 07-15-2011, 12:33 PM   #2
{BBI}Nexus{BBI}
Senior Member
 
Registered: Jan 2005
Location: Nottingham, UK
Distribution: Mageia 6, KDE Neon
Posts: 4,313

Rep: Reputation: 212Reputation: 212Reputation: 212
You could do a script that uses notify-send to popup every x secs/mins to show you users logged in. e.g.
Code:
#! /bin/bash

while [ 1 ]; do
     notify-send "Users Logged In" "`who -u`"
     sleep 5m
done
Or do your shutdown via commandline. A reminder will automatically popup (until shutdown starts) warning users the system is going down, giving them time to complete/save their work.
Code:
shutdown -h +(put number here for how long you want the system to wait before shutdown starts)
 
1 members found this post helpful.
Old 07-15-2011, 05:42 PM   #3
jv2112
Member
 
Registered: Jan 2009
Location: New England
Distribution: Arch Linux
Posts: 719

Rep: Reputation: 106Reputation: 106
Lightbulb



This will create a log and notify you in real time via notify send and voice for any user logged in that is not the original user. I tested and it works on mys system.

Hope this helps.

Quote:
1 #! /bin/bash
2 touch /home/joe/System-Logs/loguser
3 date >> /home/joe/System-Logs/loguser
4
5 while [ 1 ]
6 do notify-send "User Logged in: $(who -u| grep -v $USER| cut -c1-8)"
7 espeak "Unwanted log in by"
8 espeak $(who -u | grep -v $USER)
9 echo $(who -u | grep -v $USER ) >> /home/joe/System-Logs/loguser
10 sleep 5
11 done



 
1 members found this post helpful.
Old 07-15-2011, 05:45 PM   #4
{BBI}Nexus{BBI}
Senior Member
 
Registered: Jan 2005
Location: Nottingham, UK
Distribution: Mageia 6, KDE Neon
Posts: 4,313

Rep: Reputation: 212Reputation: 212Reputation: 212
Quote:
Originally Posted by jv2112 View Post


This will create a log and notify you in real time via notify send and voice for any user logged in that is not the original user. I tested and it works on mys system.

Hope this helps.
I knew my simple method would get beaten Just a slight addition. Replace /home/joe with your username.

Last edited by {BBI}Nexus{BBI}; 07-15-2011 at 05:46 PM.
 
1 members found this post helpful.
  


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
SSH login notification. Where to start manwithaplan Linux - Server 6 08-26-2009 09:08 AM
Email notification for FTP Login? Panicker Linux - Newbie 5 01-27-2009 06:15 AM
Get mail notification on SSH logins globemast Linux - Security 1 10-30-2007 05:38 PM
notification of user login and logout JudyL Programming 9 08-31-2007 10:47 AM
SSH Login Notification holdika Linux - Newbie 4 08-11-2004 03:39 PM

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

All times are GMT -5. The time now is 01:55 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