遠程桌面連接centos 7


首先安裝tigervnc-server:

yum install tigervnc-server

 

安裝好后,設置 vi /etc/sysconfig/vncservers

復制代碼
[root@gateway-001 ~]# cat /etc/sysconfig/vncservers 
# The VNCSERVERS variable is a list of display:user pairs.
#
# Uncomment the lines below to start a VNC server on display :2
# as my 'myusername' (adjust this to your own).  You will also
# need to set a VNC password; run 'man vncpasswd' to see how
# to do that.  
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted!  For a secure way of using VNC, see this URL:
# https://access.redhat.com/knowledge/solutions/7027

# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.

# Use "-localhost" to prevent remote VNC clients connecting except when
# doing so through a secure tunnel.  See the "-via" option in the
# `man vncviewer' manual page.

VNCSERVERS="1:root"
VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost"
VNCSERVERS="2:work"
VNCSERVERARGS[2]="-geometry 1024x768  -nolisten tcp -localhost"
復制代碼

 

 

啟動vncserver服務器:

[root@gateway-001 ~]# service vncserver start

切換到work用戶,設置vncpasswd

image

在服務器上可以看到打開的vnc端口:

image

 

 

 

在windows上安裝viewvnc,輸入ip地址和端口號進行連接:

 

image

輸入密碼:

image

可以看到成功的連接上了centos 6.5的桌面:

image

 

 

 

/etc/sysconfig/iptables

復制代碼
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 6000:6010 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 177 -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited



COMMIT
復制代碼

關閉防火牆: /etc/init.d/iptables stop 使用root賬號


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM