the man page for vncviewer presents the -via gateway option to use ssh through a gateway. I understand if I want a secure vnc connection to server.foo.com I can use the command: vncviewer localhost -via server.foo.com But I have moved my SSHD services from port 22 to port n. So according to the man pages, I need an environment variable of VNC_VIA_CMD and override the default command with: /usr/bin/ssh -p 7722 -f -L "$L":"$H":"$R" "$G" sleep 20 where 7722 is the port for sshd. How do I set up this environment variable on my notebook. Would I modify my .bash_profile file, and is the format of the added line: VNC_VIA_CMD=/usr/bin/ssh -p 7722 -f -L "$L":"$H":"$R" "$G" sleep 20 ???