Server Fault is a question and answer site for system and network administrators. 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

I would like to setup one of the SSH connections in my ssh_config file to use the -N ssh flag. I can't find any matching config keyword for this parameter. I'm using the connection for port forwarding only and I would like it to use -N every time I execute ssh host. I'm using mosh for the interactive shell.

-N      Do not execute a remote command.  This is useful for just forwarding ports (protocol version 2 only).
share|improve this question

I'm fairly sure you can't do that and like you I can't find a way of doing it in the manner that you want. If typing ssh -N host doesn't appeal then you could always try creating an alias if mosh supports it.

share|improve this answer
Yeah thanks, my plan was to use the ssh config together with the ssh workflow for Alfred (OS X). That would allow me to type ssh vps01 in Alfred and have it launch a terminal window for forwarding without the shell. Guess I'll have to solve it some other way then :) – Daniel Johansson Sep 11 '13 at 13:34
@DanielJohansson: I don't know anything about mosh but in bash you could alias it. – Iain Sep 11 '13 at 13:41

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.