Super User is a question and answer site for computer enthusiasts and power users. 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

How do I add "-X" into my ssh default option? i.e., when I type ssh A.B.C.D, it should really do ssh -X A.B.C.D

I can alias it, but is there a more "elegant" solution to do that in .ssh/config file?

share|improve this question
up vote 7 down vote accepted

You need the ~/.ssh/config file ForwardX11 or ForwardX11Trusted options.

Specifically, if you want to add -X to every invocation of ssh, put something like this in your config file:

ForwardX11 yes

If you want to use if only for certain hosts, you need to set up a host specification for each host:

Host <hostname>
  ForwardX11 yes

Check out the man page for ssh_config and ssh for more details.

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.