Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Security
User Name
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.


  Search this Thread
Old 08-10-2007, 03:29 PM   #1
Registered: Jul 2007
Location: NY, NY
Distribution: RHEL, CentOS, FC, Ubuntu
Posts: 115

Rep: Reputation: 17
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?

- Van
Old 08-10-2007, 10:54 PM   #2
Senior Member
Registered: Sep 2003
Posts: 3,171

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


ssh, vnc

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
allow SSH service securely cynick Linux - Security 4 04-21-2006 10:22 PM
vnc over ssh ieuuk Linux - Networking 18 01-18-2006 07:11 AM
ssh with vnc Dillius Linux - Security 1 03-11-2005 04:53 PM
vnc with ssh lawkh Linux - Newbie 1 02-10-2004 01:12 AM
VNC and SSH jrmann1999 Linux - Networking 0 12-26-2001 09:43 AM

All times are GMT -5. The time now is 05:04 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration