AMAZON EC2:我的主机拒绝了VNC连接(ubuntu)

时间:2018-07-27 09:20:32

标签: amazon-ec2 vnc-server vnc-viewer

我尝试远程连接到我的Amazon EC2服务器(按照本教程http://www.brianlinkletter.com/how-to-run-gui-applications-xfce-on-an-amazon-aws-cloud-server-instance/,我在Amazon EC2服务器上安装了vncserver)。

我遵循了所有说明,并且命令“ xeyes”在我的笔记本电脑Ubuntu上运行良好,但是当我启动命令时:

xvncviewer localhost:1

连接被拒绝:

 main:        unable to connect to host: Connection refused (111)

我已经在VNC上定义了密码以供参考。

问题出在哪里?请帮我 !!

3 个答案:

答案 0 :(得分:0)

对不起,我没有启动VNC服务器...。  但现在连接正常,但我的屏幕上没有任何显示:

    Fri Jul 27 09:57:29 2018
 vncext:      VNC extension running!
 vncext:      Listening for VNC connections on local interface(s), port 5901
 vncext:      created VNC server for screen 0
/usr/bin/startxfce4: X server already running on display :1
gpg-agent[862]: WARNING: "--write-env-file" is an obsolete option - it has no effect
gpg-agent: a gpg-agent is already running - not starting a new one

(xfce4-session:849): xfce4-session-WARNING **: gpg-agent returned no PID in the variables

(xfce4-session:849): xfce4-session-WARNING **: xfsm_manager_load_session: Something wrong with /home/jamal/.cache/sessions/xfce4-session-kali:1, Does it exist? Permissions issue?

(xfsettingsd:878): xfsettingsd-WARNING **: Failed to get the _NET_NUMBER_OF_DESKTOPS property.

(xfwm4:866): xfwm4-WARNING **: Error opening /dev/dri/card0: Permission denied

** (light-locker:875): ERROR **: Environment variable XDG_SESSION_PATH not set. Is LightDM running?

Fri Jul 27 09:59:01 2018
 Connections: accepted: [::1]::41716
 SConnection: Client needs protocol version 3.8
 SConnection: Client requests security type VncAuth(2)

Fri Jul 27 09:59:05 2018
 VNCSConnST:  Server default pixel format depth 24 (32bpp) little-endian rgb888
 VNCSConnST:  Client pixel format depth 6 (8bpp) rgb222
 VNCSConnST:  Client pixel format depth 24 (32bpp) little-endian rgb888

在vnc日志上方。

我的用户在sudoers文件(ALL:ALL:ALL)中拥有所有管理员权限。

答案 1 :(得分:0)

现在一切正常!我不知道为什么,但是几次后窗户就出现了!

感谢阅读

答案 2 :(得分:0)

首先使用命令行登录终端,如下所示:

ssh -L 5902:localhost:5902 -i yourkey.pem ubuntu@ec2-XX-XXX-XX-XX.us-west-2.compute.amazonaws.com

使连接的命令行保持打开状态。然后在您的VNC Viewer上,尝试使用以下方法进行访问:

localhost:5902

作为VNC服务器地址。它将要求您输入密码,然后加载GUI。