Run script when someone telnet my server
installation:
sudo apt-get install xinetd telnetd
/etc/xinetd.d/telnet file content:
service login
{
port = 23
socket_type = stream
protocol = tcp
wait = no
user = root
server = /usr/bin/script.sh
server_args = test
}
/etc/xinetd.conf content:
{
# Please note that you need a log_type line to be able to use log_on_success
# and log_on_failure. The default is the following :
# log_type = SYSLOG daemon info
instances = 60
log_type = SYSLOG authpriv
log_on_success = HOST PID
log_on_failure = HOST
cps = 25 30
}
includedir /etc/xinetd.d
/etc/inetd.conf content:
telnet stream tcp nowait telnetd /usr/bin/script.sh
Restart xinetd:
/etc/init.d/xinetd restart
EDIT:
Don't forget
chmod +x /usr/bin/script.sh
Xinetd server connection refused
Did you add that and then fail to tell xinetd
to re-read the configuration files? You can use kill -HUP $(< /var/run/xinetd.pid)
to restart it with a re-read of configuration files in a typical install.
Related Topics
Numa Aware Cache Aligned Memory Allocation
Count the Number of Times a Word Appears in a File
How to Get the Exit Status a Loop in Bash
Can Inode and Crtime Be Used as a Unique File Identifier
Deceive the Jvm About the Number of Available Cores (On Linux)
How to Develop Opengl Es (Gles) 2.0 Applications on Linux
How to Pass a Value to a Builtin Linux Kernel Module at Boot Time
How to Create a JSON Web Token (Jwt) Using Openssl Shell Commands
Parsing Shell Script Arguments
Cuda Performance Penalty When Running in Windows
Find and Remove Files with Space Using Find Command on Linux
Using Output of Awk to Run Command
Gdb Break When Program Opens Specific File
How Is Pthread_Join Implemented
What Scheduling Algorithms Does Linux Kernel Use
How to Install Xvfb (X Virtual Framebuffer) on Redhat 6.5