Ethical Hacking

Learn to find vulnerabilities before the bad guys do! Gain real world hands on hacking experience in our state of the art hacking lab. Course designed and taught by expert instructors with years of penetration testing experience. 12 student maximum in every class. Certification attempt included in every package.
Computer Forensics Training at InfoSec Institute

Gain the in-demand skills of a certified computer examiner, learn to recover trace data left behind by fraud, theft, and cybercrime perpetrators. Discover the source of computer crime and abuse at your organization so that it never happens again. All of our class sizes are guaranteed to be 12 students or less to facilitate one-on-one interaction with one of our expert instructors.




Network Security Secure-Shell
[Top] [All Lists]

Re: Starting daemon using ssh

Subject: Re: Starting daemon using ssh
Date: Thu, 4 Nov 2004 07:51:28 -0500
On Tue, Nov 02, 2004 at 08:19:39AM +0100, Binninger, Martin wrote:
While trying, to start a daemon on a remote machine using ssh, the client
doesn't return to the local prompt after performing the start-up of the
daemon.

This question seems to come up at least once a month.

imadev:~$ time ssh localhost 'sleep 20 &'
wooledg@localhost's password: 

real    0m22.757s
user    0m0.080s
sys     0m0.020s

imadev:~$ time ssh localhost 'sleep 20 >/dev/null 2>&1 &'
wooledg@localhost's password: 

real    0m2.298s
user    0m0.080s
sys     0m0.020s
imadev:~$ ps -ef | grep sleep
 wooledg 26650 11055  0 07:49:21 pts/1     0:00 grep sleep
 wooledg 26648     1  0 07:49:17 ?         0:00 sleep 20


Any more questions?

Fix your daemon-starting scripts.  Don't leave file descriptors
hanging.  Redirect everything to a logfile.  In Bourne shell syntax,
you can do that like this:

#!/bin/sh

PATH=....
export PATH

exec >>/var/log/whatever 2>&1

case "$1" in
    start) .... ;;
    stop)  .... ;;
    ....
esac

<Prev in Thread] Current Thread [Next in Thread>