LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 04-13-2007, 07:26 PM   #1
bijit1709
Member
 
Registered: Oct 2006
Location: Costa Rica, Escazu
Distribution: Slackware 12.0 (2.6.21.5)
Posts: 67

Rep: Reputation: 15
Alert Message when someoe connect to a server.


I need help on how to create a ksh program to detect when a user connects to my server through a message.

Thanks in Advance
 
Old 04-14-2007, 03:32 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,415

Rep: Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968
when someone logs in, they are usually logged in /var/log/messages of /var/log/secure. just watch that with your tool of choice.
 
Old 04-14-2007, 03:47 PM   #3
kshkid
Member
 
Registered: Dec 2005
Distribution: RHEL3, FC3
Posts: 383

Rep: Reputation: 30
how do they connect to the server via
ftp
ssh
telnet

you could monitor for the instances spawned by these daemons
so that if you have any instance that doesnt belong to you .. an alarm could be triggered

Code:
ps -ef
 
Old 04-14-2007, 06:24 PM   #4
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,396
Blog Entries: 2

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
Or, more generally, any time a TCP (or UDP?) connection is established on a port with a listener bound to it. In that case, you could use an iptables rule to log the connection event, and then a daemon that watches the log file could issue some sort of message.

--- rod.
 
Old 04-15-2007, 03:30 AM   #5
bijit1709
Member
 
Registered: Oct 2006
Location: Costa Rica, Escazu
Distribution: Slackware 12.0 (2.6.21.5)
Posts: 67

Original Poster
Rep: Reputation: 15
Arrow

It via:
ftp
ssh

I was thinking in a (FIFO) and syslog something like this:

#!bin/ksh

while cat /path/fifo; do

write admin <<- EOF
$info
EOF

sleep 2

done

How can I make a prompt like screen in a shell? For either display a short message or ask something. The promt I am referring to is like when you look your box and you move your mouse a lil box prompts your password..something like that..

ps.. could you post an example of what you would do??

Thank
 
Old 04-15-2007, 04:31 AM   #6
omnio
Member
 
Registered: Feb 2007
Location: $HOME
Distribution: Hardened Gentoo
Posts: 66
Blog Entries: 1

Rep: Reputation: 16
Quote:
Originally Posted by bijit1709
How can I make a prompt like screen in a shell? For either display a short message or ask something. The promt I am referring to is like when you look your box and you move your mouse a lil box prompts your password..something like that..
You mean, under X? You can try this if you have Xdialog installed:
Code:
Xdialog --msgbox "Hello how are you?" 0 0
Or even something very simple, like:
Code:
xterm -e "echo 'Hello how are you? Press any key.' ; read a"
Quote:
Originally Posted by bijit1709
ps.. could you post an example of what you would do??
As I need some lightweight solution but I also need these "alerts" to be sent to my e-mail address, I use logsend , but it's written in bash and you need a ksh script. Yes, you could tail (-f) the logfile to a fifo and perform some action while reading that fifo.

Last edited by omnio; 04-15-2007 at 05:26 AM.
 
Old 04-22-2007, 11:26 AM   #7
bijit1709
Member
 
Registered: Oct 2006
Location: Costa Rica, Escazu
Distribution: Slackware 12.0 (2.6.21.5)
Posts: 67

Original Poster
Rep: Reputation: 15
Thanks for all yours post. It has really been helpful. How can i disable CTRL+D, CTRL+C On a shell script. Only Trap can do it or is there any other function that can do the job? ANd also how can i hide what a user types on the shell like when it prompts a password? Using echo or any other promt function?

eg:
echo -n "Type in your passwd "

Thanks
 
  


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
Alert for server shutdown sunhui Linux - Software 1 08-02-2006 05:03 PM
server mailbox alert The Bad Penny Linux - Software 1 12-08-2004 07:13 PM
how to produce pop-up message box / alert window from shell script peb Linux - Newbie 3 02-25-2004 04:14 AM
Redhat Alert Notification Tool - kernel message derekfairley Linux - Newbie 2 11-10-2003 03:08 AM
Oracle9i Database Server Problems (latest alert) PostDeals Linux - Security 0 04-22-2002 08:34 PM


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