LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   Securely using VNC over SSH (https://www.linuxquestions.org/questions/linux-security-4/securely-using-vnc-over-ssh-576216/)

Vanyel 08-10-2007 03:29 PM

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

#!/bin/sh
ssh -L 5900:localhost:5900 -l van <target computer> &
vncviewer 127.0.0.1:0


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?


- Van

jiml8 08-10-2007 10:54 PM

ssh -f -L 5901:localhost:5900 targetcomputer sleep 20
vncviewer -owncmap localhost:1


All times are GMT -5. The time now is 03:39 PM.