最近,由于项目需要,必须要在centos下进行操作。习惯了图形界面的我,通过黑框框来远程操作服务器,着实让人难受。但是,windows自带的远程桌面工具貌似不能直接连centos。所以,只能借助其他工具来实现这一目的。好了,废话不多说,下面,就把我的成功方案总结一下。

注:centos版本为7,windows版本为8

1.服务器端(centos)

安装组件

yum install -y vnc-server

配置文件

[root@localhost /]# cp /lib/systemd/system/vncserver@:.service /etc/systemd/system/vncserver@:1.service
[root@localhost /]# gedit /etc/systemd/system/vncserver@:1.service

文件vncserver@:1.service的内容:

# The vncserver service unit file
#
# Quick HowTo:
# 1. Copy this file to /etc/systemd/system/vncserver@.service
# 2. Edit <USER> and vncserver parameters appropriately
# ("runuser -l <USER> -c /usr/bin/vncserver %i -arg1 -arg2")
# 3. Run `systemctl daemon-reload`
# 4. Run `systemctl enable vncserver@:<display>.service`
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted! For a secure way of using VNC, you should
# limit connections to the local host and then tunnel from
# the machine you want to view VNC on (host A) to the machine
# whose VNC output you want to view (host B)
#
# [user@hostA ~]$ ssh -v -C -L 590N:localhost:590M hostB
#
# this will open a connection on port 590N of your hostA to hostB's port 590M
# (in fact, it ssh-connects to hostB and then connects to localhost (on hostB).
# See the ssh man page for details on port forwarding)
#
# You can then point a VNC client on hostA at vncdisplay N of localhost and with
# the help of ssh, you end up seeing what hostB makes available on port 590M
#
# 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. [Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target [Service]
Type=forking
# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/usr/sbin/runuser -l admin -c "/usr/bin/vncserver %i"
PIDFile=/home/admin/.vnc/%H%i.pid
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :' [Install]
WantedBy=multi-user.target

需要修改的部分:

[Service]
Type=forking
# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/usr/sbin/runuser -l <User> -c "/usr/bin/vncserver %i"
PIDFile=/home/<User>/.vnc/%H%i.pid
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'

把这部分中的<User>都改成admin,即远程登录的用户名

重新加载vncserver@:1.service

[root@localhost /]# systemctl daemon-reload

设置密码

[root@localhost /]# vncpasswd

设置开机启动

[root@localhost /]# systemctl enable vncserver@:1.service

启动服务

[root@localhost /]# systemctl start vncserver@:1.service

防火墙设置

关闭防火墙

[root@localhost /]# systemctl stop firewalld

OR

添加端口

关闭服务

[root@localhost /]# vncserver -kill :1

2.客户端(windows)

文件下载

vnc views http://www.realvnc.com/download/viewer/

软件配置









windows下远程桌面连接centos的更多相关文章

  1. 在 Windows 下远程桌面连接 Linux - XManager 篇

    XManager是一个简单易用的高性能的运行在Windows平台上的X-Server软件,而Gnome和KDE就是X-Client,Linux下的X-Server则为Xorg.它能把远端Unix/Li ...

  2. 在 Windows 下远程桌面连接 Linux - VNC 篇

    VNC是由AT&T试验室开发,是一款优秀的远程控制工具软件,后来以GPL授权的形式开源.经过几年的发展,现在的VNC已经不单指某个软件,而是一类软件的通称.下面介绍Linux下常用的两个VNC ...

  3. xmanager 在 Windows 下远程桌面连接 麒麟

    编辑/etc/gdm/custom.conf,添加如下内容: [daemon] RemoteGreeter=/usr/libexec/gdmgreeter  注:“远程登录界面与本地登录界面相同”功能 ...

  4. 20180726 - Windows 10 Pro 下远程桌面连接提示“出现身份验证错误”

    问题:Windows 10 Pro 下远程桌面连接提示“出现身份验证错误” [Window Title]远程桌面连接 [Content]出现身份验证错误.要求的函数不受支持 远程计算机: 192.16 ...

  5. 使用windows的远程桌面连接连接Ubuntu

    想起来用笔记本连接一个windows server时只需要在远程桌面连接里面输入一下ip地址然后账号密码就可以了,十分简单.于是乎既然装了个Ubuntu当服务器使那么我就业来远程连接一下,由于wind ...

  6. Windows Server 远程桌面连接不上问题解决

    关于Windows Server 远程桌面连接不上的问题需要从服务.端口.防火墙这几方面进行检查: 服务器上需要 开启的服务: - Remote Access Auto Connection Mana ...

  7. Windows下远程桌面的连接

    [系统环境] 建议Windows7以上 [步骤说明] 1.使用"WIN + R"组合键打开"运行"对话框,然后输入“mstsc”,点击确定,如下图所示: 2.点 ...

  8. Windows 7远程桌面连接Ubuntu 16.04

    转自:http://jingyan.baidu.com/article/8ebacdf0cdc64949f75cd555.html 从Windows 7远程到Windows系统比较简单,只要对方电脑开 ...

  9. RedHat6.5如何被windows系统远程桌面连接

    一.redhat 6.5远程桌面配置 服务器端: 1.设置允许其它人查看您的远程桌面 在“系统”-“首选项”-“远程桌面”-在“允许其它人查看您的远程桌面”前打勾:在“允许其它用户控制您的桌面”打勾 ...

随机推荐

  1. 使用Plsql将Excel数据导入Oracle数据库

    1.在plsql页面,Tools-->ODBC Importer... 2.配置被导入的excel files 3.选择excel文件 4.选择Excel中要被导入的的sheet工作簿,选择之后 ...

  2. IAR调节字体大小

    在主面板上点击tools->Options,然后点开Editor,选择下面的Colors and Fonts选项,最后选右上方的Font,选择要设置的字体就OK了.

  3. 开发《基于Arcgis Online的家政管理服务信息系统》随笔2

    解决了三天的一个问题终于搞定了,和大家分享一下... 1.来点开胃菜,  在Sql server 2008中想要增加修改字段,有时不能修改,作如下操作即可搞定此问题, 启动MSSQL SERVER 2 ...

  4. 通过浏览器https能够访问SVN,但eclipse SVN,tortoiseSVN始终连接不上SVN的问题解决方案

    为了便于本地代码维护,特意在本地搭建了一个visualSVN服务器用于本地代码管理,但是最近突然出现问题,eclipse上的SVN资源库始终连接不上,提示 "svn: connection ...

  5. android Spinner的简单用法

    上代码: spinner = (Spinner) findViewById(R.id.spinner); tv = (TextView) findViewById(R.id.tv); final Ar ...

  6. shell判断FTP传输是否成功

    #!/bin/bash ##判断FTP传输文件是否成功 exec 6>&1 1>/tmp/lzc.txt ##打开一个文件描述符6,保存文件描述符1的属性,然后将描述1重定向到lz ...

  7. ios LoadView 方法

    当ViewController中的View不通过nib文件而是自己来创建的时候需要重载LoadView方法.否则不需要重载LoadView方法.

  8. php查看网页源代码的方法

    这篇文章主要介绍了php查看网页源代码的方法,涉及php读取网页文件的技巧,具有一定参考借鉴价值,需要的朋友可以参考下     本文实例讲述了php查看网页源代码的方法.分享给大家供大家参考.具体实现 ...

  9. easyui datagrid 点击列表头排序出现错乱的原因

    之前我的导师,也就是带我的同事,使用datagrid,发现点击列表头排序出现乱序,按理说只有顺序和逆序两种排序结果.因为他比较忙,当时没解决,把排序禁掉了,后来又要求一定要排序,所以他交给我. 一开始 ...

  10. 如何在Flex标签中写事件函数

    在事件变量值中直接写函数语句,如果是多条语句,则用";"号隔开. 示例如下: <mx:Box id="label" backgroundColor=&qu ...