3

For a given ssh session, is there a way to tell if it has x-forwarding enabled? I.e. you don't know if the session was established with ssh username@address or with ssh -X username@address.

1 Answers1

4

One simple indication is to look to see if a valid looking DISPLAY variable is set. If no display is set, you can be almost certain forwarding is not working properly.

$ export | grep DISPLAY
declare -x DISPLAY="localhost:10.0"
Zoredache
  • 128,755
  • 40
  • 271
  • 413