Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

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

How can I supply additional options in .ssh/config? I know that information like Host, Port, User etc. may be used in the ssh-configuration file to abbreviate ssh commands. I frequently create ssh-tunnels using the options "-Nf" to fork to the background. Is it possible to provide such options within the configuration file as well, and how?

share|improve this question

I often do the same thing with LocalForward directives. I also use connection muxing with ControlMaster, ControlPersist, and ControlPath directives; if I want to have a connection that I use just for the tunnels, since my connections' muxers persist for 30 minutes, I can ssh user@hostname.example.com logout and have 30 minutes to open any tunnelled connections, and the tunnels will remain open until I've not used any of them for 30 minutes.

Here are the relevant bits of my ~/.ssh/config:

ControlMaster auto
ControlPath ~/.ssh/mux/ssh_mux_%h_%p_%r
ControlPersist 30m

host shortname
    User username
    HostName remotehost.example.com
    LocalForward localhost:1234
share|improve this answer

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.