LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-27-2014, 11:09 PM   #1
cmorris14
LQ Newbie
 
Registered: May 2014
Posts: 12

Rep: Reputation: Disabled
VNC - The connection was refused by the host computer


I have setup a RHEL machine in EC2 and am able to work with it using SSH fine. I followed this guide to install a GUI: http://stackoverflow.com/questions/5...n-ec2#13318570 and it worked fine.

Since then, I have created other EC2 instances, following the same guide, using both RHEL and CentOS; however, when trying to connect via VNC I get the error: The connection was refused by the host computer.

What am I doing wrong? I have a security rule configured in EC2 that allows incoming traffic to port 5902 and the host's iptables has a similar rule.

Hoping to get this working ASAP as I will be away soon and wanted to fully set this up and transfer over some files before then.
 
Old 06-27-2014, 11:21 PM   #2
notsure
Member
 
Registered: Jun 2012
Location: Detroit
Distribution: Arch x86_64
Posts: 112

Rep: Reputation: 10
You shouldn't open VNC to the internet because VNC sends the password plain text. I highly recommend you tunnel it through ssh:

ssh -L 59000:localhost:5900 hostname

point VNC to your localhost:59000

Last edited by notsure; 06-27-2014 at 11:23 PM.
 
Old 06-27-2014, 11:39 PM   #3
cmorris14
LQ Newbie
 
Registered: May 2014
Posts: 12

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by notsure View Post
You shouldn't open VNC to the internet because VNC sends the password plain text. I highly recommend you tunnel it through ssh:

ssh -L 59000:localhost:5900 hostname

point VNC to your localhost:59000
Permission denied (running as root)

I only need VNC for a few hours, once it is up, then I can disable it and remove the iptables rule.
 
Old 06-28-2014, 12:01 AM   #4
notsure
Member
 
Registered: Jun 2012
Location: Detroit
Distribution: Arch x86_64
Posts: 112

Rep: Reputation: 10
What vnc viewer program are you using?

Did you replace
Code:
VNCSERVERS="2:myuser" VNCSERVERARGS[2]="-geometry 1280x1024"
with your user account?

It seems like you're getting to the host however, execute
Code:
nmap localhost
on the vncserver to make sure it is 5902.
 
Old 06-28-2014, 12:27 AM   #5
cmorris14
LQ Newbie
 
Registered: May 2014
Posts: 12

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by notsure View Post
What vnc viewer program are you using?

Did you replace
Code:
VNCSERVERS="2:myuser" VNCSERVERARGS[2]="-geometry 1280x1024"
with your user account?

It seems like you're getting to the host however, execute
Code:
nmap localhost
on the vncserver to make sure it is 5902.
I am using RealVNC.

I did replace the username with the actual username.

nmap output:
Code:
nmap localhost

Starting Nmap 5.51 ( http://nmap.org ) at 2014-06-28 00:25 EDT
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000012s latency).
Other addresses for localhost (not scanned): 127.0.0.1
Not shown: 996 closed ports
PORT    STATE SERVICE
22/tcp  open  ssh
25/tcp  open  smtp
111/tcp open  rpcbind
631/tcp open  ipp
nmap scan of 5902
Code:
nmap -p 5902 localhost

Starting Nmap 5.51 ( http://nmap.org ) at 2014-06-28 00:27 EDT
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000083s latency).
Other addresses for localhost (not scanned): 127.0.0.1
PORT     STATE  SERVICE
5902/tcp closed vnc-2

Nmap done: 1 IP address (1 host up) scanned in 0.06 seconds
 
Old 06-28-2014, 12:41 AM   #6
notsure
Member
 
Registered: Jun 2012
Location: Detroit
Distribution: Arch x86_64
Posts: 112

Rep: Reputation: 10
vncserver isn't running for some reason.

Is there a ".vnc" directory in your user home directory? Is there a "passwd" file in there?

If no to either of those you need to run "vncserver" as the user, it will create the passwd file. Then start the vncserver service. service vncserver start or /etc/init.d/vncserver start
 
1 members found this post helpful.
Old 06-28-2014, 01:02 AM   #7
cmorris14
LQ Newbie
 
Registered: May 2014
Posts: 12

Original Poster
Rep: Reputation: Disabled
Thank you, got it working!

The problem was that I ran the vncserver command after installing the server and set the password, but I was root when I ran the command and I am trying to login as another user. I just ran the command as another user and set the password and can now get in.

Thanks again.
 
Old 06-28-2014, 01:18 AM   #8
notsure
Member
 
Registered: Jun 2012
Location: Detroit
Distribution: Arch x86_64
Posts: 112

Rep: Reputation: 10
Oh JOY!
 
  


Reply


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
VNC connection refused dragunu Linux - Newbie 3 11-11-2006 11:38 AM
Vnc : Connection refused dragunu Linux - Newbie 5 04-25-2006 06:54 AM
VNC - Connection refused silkyd Linux - Networking 12 03-29-2006 09:09 AM
VNC Connection Refused markpadam Linux - Security 5 05-07-2004 08:02 PM
VNC Connection refused pacman Linux - Software 7 08-08-2003 01:51 AM


All times are GMT -5. The time now is 03:18 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration