LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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, 07: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, 01:33 PM   #2
{BBI}Nexus{BBI}
Senior Member
 
Registered: Jan 2005
Location: Nottingham, UK
Distribution: Mageia 5, Linux Lite
Posts: 4,312

Rep: Reputation: 208Reputation: 208Reputation: 208
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, 06:42 PM   #3
jv2112
Member
 
Registered: Jan 2009
Location: New England
Distribution: Arch Linux
Posts: 719

Rep: Reputation: 103Reputation: 103
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, 06:45 PM   #4
{BBI}Nexus{BBI}
Senior Member
 
Registered: Jan 2005
Location: Nottingham, UK
Distribution: Mageia 5, Linux Lite
Posts: 4,312

Rep: Reputation: 208Reputation: 208Reputation: 208
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 06:46 PM.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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


All times are GMT -5. The time now is 05:11 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration