For various purposes it's useful to pass some more or less fixed string from the client to the server side. E.g. when forwarding sockets, the remote socket name needs to include some string unique to the local side (like the host name) to avoid collisions between connections from different hosts. Think gpg-agent forwarding or using emacsclient on the remote host to open the file (via TRAMP) on the local host. This is currently possibly by using a wrapper script around ssh that sets some environment variable, but setting an environment variable directly in ssh_config would make things a lot smoother (no messing with PATH required). Being able to expand environment variables and use expansions like in the Match directive would be nice, but even a fixed string would go a long way. E.g.: === Begin .ssh/config === Host *.localdomain SetEnv EMACS_SOCKET=/home/sascha/.emacs.d/server/server.%l SetEnv GPG_AGENT_INFO=/home/sascha/.gnupg/S.gpg-agent.%l:1:1 Host myserver.localdomain RemoteForward /home/sascha/.emacs.d/server/server.mydesktop:/tmp/emacs8193/server RemoteForward /home/sascha/.gnupg/S.gpg-agent.mydesktop:/home/sascha/.gnupg/S.gpg-agent === End .ssh/config === (As you can see, environment variables and Match-like expansions would be useful in RemoteForward as well, but that's a feature request for another day).
ssh_config (and sshd_config) now have a SetEnv option that does just this.
*** Bug 2875 has been marked as a duplicate of this bug. ***
Thanks! Does the current implementation support keyword expansion? The man page doesn't say and I couldn't see any expansion happening in the code (but I may have overlooked it). I'm using the same SSH config on multiple hosts so being able to expand the local hostname (%l, like in my example above) would be really useful.
closing resolved bugs as of 8.6p1 release