X-Git-Url: http://git.onelab.eu/?p=pl_sshd.git;a=blobdiff_plain;f=pl_sshd.sh;h=d19c34353519cb85f5d4a961ef94e673c68c46df;hp=4fa07c49003a90826d3a5c4775f0f1512030aacf;hb=e05a8634df6a726188b495941800f4dd9f6b7820;hpb=e2c63e32ae96ef9a058140087f691ca1cf0247d3 diff --git a/pl_sshd.sh b/pl_sshd.sh index 4fa07c4..d19c343 100755 --- a/pl_sshd.sh +++ b/pl_sshd.sh @@ -1,3 +1,24 @@ #!/bin/sh +# +# this wrapper runs sshd on an alternate port with a different argv[0] +# and PID file (rather annoyingly, the latter has to be specified +# explicitly even if argv[0] is changed). +# +# the alternate port is necessary so we can have two instances of sshd +# running, the different name and PID file are required so that stopping +# the standard sshd won't affect this one. +# +# we use port 806 unless there is a '-p' argument specifying a different +# port. we also have to specify a different PID file so that one sshd +# doesn't clobber the other's PID file. +# +# XXX - unfortunately the standard init.d/sshd script is fairly brutal +# when stopping sshd processes - it will stop anything that looks +# remotely like sshd. the measures taken here still don't prevent that +# but i have decided that restarting/stopping sshd should be sufficiently +# rare that it's not worth worrying about to any greater extent. +# +name=pl_sshd +echo "$@" | grep -q -- '-p[ 0-9]' || port='-p 806' -exec -a pl_sshd /usr/sbin/sshd "$@" +exec -a $name /usr/sbin/sshd -o "PidFile /var/run/$name.pid" $port "$@"