LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 01-26-2021, 05:58 PM   #1
notooth
Member
 
Registered: Apr 2005
Posts: 192

Rep: Reputation: 15
How to connect VNC without SSH?


Hello,

I successfully connected to a VNC server through an SSH tunnel, but it didn't let me do that without SSH. Is there a way to disable SSH and connect directly to the VNC server?
 
Old 01-26-2021, 07:40 PM   #2
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,640

Rep: Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697
It is EASY, the default VNC server/client setup did not use SSH originally. The problem is that you would have to have control of both ends. If the server end is set up to REQUIRE ssh, then the VNC client MUST use SSH to reach it. Do you have control of both ends?
 
Old 01-27-2021, 02:01 AM   #3
notooth
Member
 
Registered: Apr 2005
Posts: 192

Original Poster
Rep: Reputation: 15
Yes, I have control of both ends. What should I do?
 
Old 01-27-2021, 02:05 AM   #4
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,312
Blog Entries: 3

Rep: Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722
You should still use SSH, since if the raw VNC interface gets exposed to the net, intruders will find it and use it to quickly and easily enter your system.
 
1 members found this post helpful.
Old 01-27-2021, 07:25 AM   #5
notooth
Member
 
Registered: Apr 2005
Posts: 192

Original Poster
Rep: Reputation: 15
It's just a connection between a host and a local VM.
 
Old 01-27-2021, 07:58 AM   #6
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Does the VM allow connection requests to the VNC ports? Some distros like Centos or Fedora block all ports except SSH by default.
 
Old 01-27-2021, 09:13 AM   #7
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,640

Rep: Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697
Quote:
Originally Posted by wpeckham View Post
It is EASY, the default VNC server/client setup did not use SSH originally. The problem is that you would have to have control of both ends. If the server end is set up to REQUIRE ssh, then the VNC client MUST use SSH to reach it. Do you have control of both ends?
It suddenly occurs to me to ask: WHY would you want to eliminate ssh from the vnc connection?
I mean: it is working as configured, and that IS the preferred method. Why break it just to eliminate SSH?
 
Old 01-27-2021, 09:31 AM   #8
notooth
Member
 
Registered: Apr 2005
Posts: 192

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by berndbausch View Post
Does the VM allow connection requests to the VNC ports? Some distros like Centos or Fedora block all ports except SSH by default.
I don't know. It's Debian 10.7 with default installation on the VM.
 
Old 01-27-2021, 05:14 PM   #9
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by notooth View Post
it didn't let me do that without SSH. Is there a way to disable SSH and connect directly to the VNC server?
It occurs to me that we don't know what exactly happens. How do you try to connect, which IP address and port are you using, and what are the symptoms (e.g. error message)?

Also how did you create the tunnel.

To connect directly, use the server's IP address followed by a colon and the display number. Instead of the display number, you can use the port, which is normally 5900+DISPLAYNUMBER.

As far as I know, Debian doesn't block network ports by default.
 
Old 01-28-2021, 02:28 AM   #10
notooth
Member
 
Registered: Apr 2005
Posts: 192

Original Poster
Rep: Reputation: 15
This is how I successfully used the tunnel:
Code:
$ ssh -L 5901:localhost:5901 notooth@10.0.0.5
$ vncviewer localhost:5901
This is how I failed to use a direct connection:
Code:
$ vncviewer 10.0.0.5:1
Error: unable connect to socket: Connection refused (61)
 
Old 01-28-2021, 03:40 AM   #11
andre@home
Member
 
Registered: Oct 2003
Distribution: 2x Debian 8.1 webdav servers
Posts: 93

Rep: Reputation: 44
Is the port you tried to use without SSH open in the firewall.... ?
 
Old 01-28-2021, 08:38 AM   #12
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,640

Rep: Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697Reputation: 2697
Quote:
Originally Posted by notooth View Post
This is how I successfully used the tunnel:
Code:
$ ssh -L 5901:localhost:5901 notooth@10.0.0.5
$ vncviewer localhost:5901
This is how I failed to use a direct connection:
Code:
$ vncviewer 10.0.0.5:1
Error: unable connect to socket: Connection refused (61)
Check to see if your vncserver is listening on the proper port for a direct connection. Next check to see if your firewall is runnign and blocking that port.
 
Old 01-28-2021, 07:40 PM   #13
notooth
Member
 
Registered: Apr 2005
Posts: 192

Original Poster
Rep: Reputation: 15
There is no firewall on the VM. The vncserver listens to the port 5901.
 
Old 01-28-2021, 08:14 PM   #14
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,715

Rep: Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899
Quote:
Originally Posted by notooth View Post
This is how I successfully used the tunnel:
Code:
$ ssh -L 5901:localhost:5901 notooth@10.0.0.5
$ vncviewer localhost:5901
This is how I failed to use a direct connection:
Code:
$ vncviewer 10.0.0.5:1
Error: unable connect to socket: Connection refused (61)
Have you tried

vncviewer 10.0.0.5:5901
 
Old 01-29-2021, 01:51 AM   #15
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by notooth View Post
There is no firewall on the VM. The vncserver listens to the port 5901.
Which address though? Post the output of ss -nltp | grep 5901.
 
  


Reply



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
What's the difference between VNC through SSH tunnel and VNC SSL? seraf Linux - Security 2 04-24-2018 11:07 PM
vnc server launched via ssh = gray screen. Local terminal vnc = ok link626 Linux - Newbie 1 09-15-2015 02:57 PM
VNC viewer showing black screen. unable to connect VNC server remotely on the server? cyberdome Linux - Server 1 08-01-2014 08:21 AM
VNC Over SSH | Linux laptop -> Linux SSH Server -> Windows VNC Server jakestaby Linux - Networking 3 01-28-2009 02:33 PM
ssh + pop3 with kmail: Could not connect to host localhost, but ok without ssh Emmanuel_uk Linux - Networking 0 07-20-2006 04:56 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 11:00 PM.

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