setting DISPLAY on linux while ssh’ing

If you are also fed up of exporting DISPLAY manually everytime you need to use gvim or anything else requiring ‘X’ then you will get a relief reading this post. you can use -X option

ssh -X [IP | Host]

If you use ssh -X, ssh will tunnel your X connection for you and automatically set up the appropriate X authentication. But its not all candies, there is a risk involved. I ran through the man page and found this

-X Enables X11 forwarding. This can also be specified on a per-host
basis in a configuration file.

X11 forwarding should be enabled with caution. Users with the
ability to bypass file permissions on the remote host (for the
user’s X authorization database) can access the local X11 display
through the forwarded connection. An attacker may then be able
to perform activities such as keystroke monitoring.

So take care.

Leave a Reply

You must be logged in to post a comment.