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?

1 Answer 1


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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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