LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Alert Message when someoe connect to a server. (https://www.linuxquestions.org/questions/programming-9/alert-message-when-someoe-connect-to-a-server-545883/)

bijit1709 04-13-2007 06:26 PM

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

acid_kewpie 04-14-2007 02:32 AM

when someone logs in, they are usually logged in /var/log/messages of /var/log/secure. just watch that with your tool of choice.

kshkid 04-14-2007 02:47 PM

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

theNbomr 04-14-2007 05:24 PM

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.

bijit1709 04-15-2007 02:30 AM

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

omnio 04-15-2007 03:31 AM

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.

bijit1709 04-22-2007 10:26 AM

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


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