Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to be able to run a socks4 server (the best through ssh -D) I can't put together a config file for xinetd, can anyone give me a hand? Thanks!

share|improve this question

It's pretty straighforward. Try this. If you have problems with privilege separation, you'll need to create a little script to make /var/run/sshd, and chmod 0755 it, then call ssh $*.

service ssh
   socket_type = stream
   protocol = tcp
   wait = no
   user = root
   server = /usr/sbin/sshd
   server_args = -i
   port = 22


EDIT. The first time around I completely misread the question, and assumed you just wanted sshd running in xinetd on the remote side of your tunnel, so it would just wake up when you needed your tunnel. Instead, what you're really looking for is a way to have the ssh client wake up when you need the proxy tunnel and automatically bring up the tunnel for use.

service socks-proxy
    disable         = no
    socket_type     = stream
    wait            = no
    user            = root
    server          = /usr/bin/ssh
    server_args     = -D 1234 -i /path/to/ssh-key -f remoteuser@remotehost 
    log_on_failure  += USERID

Then add the service-name 'socks-proxy' to /etc/services. Or change the service name to match an existing service from /etc/inetd with the port you'll be using. You'll need the ssh key to allow for paswordless authentication. The -f should fork the ssh to the background. You may have to tune the args a bit, but something like this should work.

share|improve this answer
I dont get it... how is this suppose to work? you didn't even specify -D – alexus Feb 15 '11 at 20:03
Sorry, Alexus. Edited the answer. I think I'm understanding what you're really trying to do, now. – Tim Kennedy Feb 15 '11 at 21:45
Apr 18 13:15:52 wcmisdlin02 xinetd[22019]: START: socks pid=22021 from=::ffff: Apr 18 13:15:52 wcmisdlin02 xinetd[22019]: EXIT: socks status=255 pid=22021 duration=0(sec) – alexus Apr 18 '12 at 17:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.