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 |
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.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
04-13-2007, 06:26 PM
|
#1
|
|
Member
Registered: Oct 2006
Location: Costa Rica, Escazu
Distribution: Slackware 12.0 (2.6.21.5)
Posts: 67
Rep:
|
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
|
|
|
|
04-14-2007, 02:32 AM
|
#2
|
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 42,827
|
when someone logs in, they are usually logged in /var/log/messages of /var/log/secure. just watch that with your tool of choice.
|
|
|
|
04-14-2007, 02:47 PM
|
#3
|
|
Member
Registered: Dec 2005
Distribution: RHEL3, FC3
Posts: 383
Rep:
|
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
|
|
|
|
04-14-2007, 05:24 PM
|
#4
|
|
LQ 5k Club
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,321
|
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.
|
|
|
|
04-15-2007, 02:30 AM
|
#5
|
|
Member
Registered: Oct 2006
Location: Costa Rica, Escazu
Distribution: Slackware 12.0 (2.6.21.5)
Posts: 67
Original Poster
Rep:
|
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
|
|
|
|
04-15-2007, 03:31 AM
|
#6
|
|
Member
Registered: Feb 2007
Location: $HOME
Distribution: Hardened Gentoo
Posts: 66
Rep:
|
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 04:26 AM.
|
|
|
|
04-22-2007, 10:26 AM
|
#7
|
|
Member
Registered: Oct 2006
Location: Costa Rica, Escazu
Distribution: Slackware 12.0 (2.6.21.5)
Posts: 67
Original Poster
Rep:
|
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
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 05:37 AM.
|
|
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
|
|