How can I set -X (X11Forwarding) in my ~/.ssh/config file for a specific host?

30,663

If you peek into the manual page for ssh_config, you will find an option ForwardX11, which can be put in your config such as:

Host wk
  Hostname W.X.Y.Z
  ForwardX11 yes

And then your connections to host wk will have X11 forwarding enabled by default.

Share:
30,663

Related videos on Youtube

Albin Glad
Author by

Albin Glad

Updated on September 18, 2022

Comments

  • Albin Glad
    Albin Glad almost 2 years

    So if I'm VPN'ing in from home, I want all of those connections to have -X specified. I already have the keys copied and an entry in ~/.config with the ip and userid so all I have to do is go: ssh wk so this is the last fly in the ointment.

  • Albin Glad
    Albin Glad over 8 years
    Yup. Numbskull moment for me although in the past the settings were different in /etc/ssh/sshd_config than they were in ~/.ssh/config
  • Jakuje
    Jakuje over 8 years
    they still are. ssh_config and sshd_config are different things with different options and different manual pages with description inside.
  • Shapeshifter
    Shapeshifter almost 5 years
    this is worth a read for anyone landing here security.stackexchange.com/questions/14815/…