Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

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 192.168.6.76:1234
share|improve this answer

Your Answer

 
discard

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.