Securely using VNC over SSH
If I do THIS in one terminal window
> ssh -L 5900:localhost:5900 -l van <target computer>
And THIS in a separate term window
> vncviewer <target computer>:0
I have a secure VNC connection to the desktop of my target computer (I already have ssh keys setup so there is no password prompt ssh-ing to the target)
But if I make one shell script with both commands
ssh -L 5900:localhost:5900 -l van <target computer> &
And execute it, I get two errors
"Pseudo-terminal will not be allocated because stdin is not a terminal"
and a VNC error
"unable to connect to host. Connection refused (111)"
How should I be scripting this so I can have one shellscript establish the ssh port forward and then run my vncviewer over it?