使用windows调用Linux远程桌面

简介:

一、安装所需要的软件

yum install -y xrdp

yum install -y vnc*

chkconfig xrdp on

chkconfig vncserver on

二、修改配置

a添加用户:useradd herry

b.设置vnc验证密码:su - herry

                             :  vncpasswd

c.修改配置:

1.[root@cloud ~]# vim /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="2:myusername"

# VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost"

VNCSERVERS="2:herry"

VNCSERVERARGS[1]="-geometry 1280x720 -nolisten tcp -localhost"


2.在防火墙中加入:

vim /etc/sysconfig/iptables

-A INPUT -m state --state NEW -m tcp -p tcp --dport 3389 -j ACCEPT


重启防火墙:service iptabels restart


三、一般服务器是没有桌面环境的,需要安装中文界面

yum groupinstall "Desktop"

 yum groupinstall "X Window System"

 yum groupinstall "Chinese Support"

重启

四、使用windows连接linux远程桌面

a.windows上敲mstsc

b.输入liunx服务器Ip地址,和验证用户名和密码(herry   l426844@)

五   报错处理:出现xrdp_mm_process_login_response: login failed

问题原因:远程桌面没有正确关闭,虽然在windows 系统关闭远程桌面连接,但是在里linux上的进程还在运行,导致连接数量达到上限,出现问题。

[root@cloud ~]# vim /etc/xrdp/sesman.ini

[Globals]

ListenAddress=127.0.0.1

ListenPort=3350

EnableUserWindowManager=1

UserWindowManager=startwm.sh

DefaultWindowManager=startwm.sh

[Security]

AllowRootLogin=1

MaxLoginRetry=4

TerminalServerUsers=tsusers

TerminalServerAdmins=tsadmins

[Sessions]

X11DisplayOffset=10

MaxSessions=100          

KillDisconnected=1

IdleTimeLimit=0

DisconnectedTimeLimit=0

[Logging]

LogFile=/var/log/xrdp-sesman.log

LogLevel=DEBUG

EnableSyslog=0

SyslogLevel=DEBUG

[X11rdp]

param1=-bs

param2=-nolisten

param3=tcp

[Xvnc]

param1=-bs

param2=-nolisten

param3=tcp

param4=-localhost

可以修改会话设置  :将最大会话限制该大  MaxSessions=50

将KillDisconnected=1;则每次断开连接时,linux都会关闭会话进程。

然后重启/etc/init.d/xrdp restart    就可解决问题

六.如果打开后,出现只有背景的情况

下面我们需要修改vnc启动文件,使用命令:

vi ~/.vnc/xstartup

打开后如下图所示wKioL1k2qULTO_BdAAIjaneezh8982.png-wh_50

spacer.gif

我们需要把上图中 “x-window-manager &” 这一行注释掉,然后在下面加入一行 “gnome-session &” ,或者是 “startkde &” ,分别表示要启用 GNOME 桌面或 KDE 桌面。以 GNOME 桌面为例,修改后如下图所示:

具体修改步骤:打开文件后,点击 insert 按钮,这时就可以输入了,在 “x-window-manager &” 前加 “#”,然后回车输入 “gnome-session &”,然后点击 “Esc ” 退出编辑模式,输入 “:wq!”保存修改即可)wKioL1k2qVaSQDwSAAFIvQU1Rmg969.png-wh_50

spacer.gif

我的机器:

[root@cloud ~]#  vi ~/.vnc/xstartup

#!/bin/sh

[ -r /etc/sysconfig/i18n ] && . /etc/sysconfig/i18n

export LANG

export SYSFONT

vncconfig -iconic &

unset SESSION_MANAGER

unset DBUS_SESSION_BUS_ADDRESS

OS=`uname -s`

if [ $OS = 'Linux' ]; then

  case "$WINDOWMANAGER" in

    *gnome*)

      if [ -e /etc/SuSE-release ]; then

        PATH=$PATH:/opt/gnome/bin

        export PATH

      fi

      ;;

  esac

fi

if [ -x /etc/X11/xinit/xinitrc ]; then

  exec /etc/X11/xinit/xinitrc

fi

if [ -f /etc/X11/xinit/xinitrc ]; then

  exec sh /etc/X11/xinit/xinitrc

fi

[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources

xsetroot -solid grey

xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &

twm &

七。登陆成功

wKiom1k2qXXTwpEAAABeFC1nsYk686.png-wh_50

wKioL1k2qXvzaGHUAAwBZKdreCI189.png-wh_50

本文转自飞奔的小GUI博客51CTO博客,原文链接http://blog.51cto.com/9237101/1932907如需转载请自行联系原作者


ziwenzhou

相关文章
|
1月前
|
Linux Shell Windows
通过Linux挂载Windows端NFS服务实现板端Linux传输文件到PC
通过Linux挂载Windows端NFS服务实现板端Linux传输文件到PC
|
1月前
|
安全 Linux Shell
全面对比linux和windows,选择哪个系统比较好
全面对比linux和windows,选择哪个系统比较好
70 0
|
2月前
|
Rust Linux iOS开发
|
11天前
|
SQL 监控 安全
Linux&Windows 日志分析 陇剑杯 CTF
Linux&Windows 日志分析 陇剑杯 CTF
|
14天前
|
Linux Windows
Windows、Mac、Linux解决端口被占用的问题
Windows、Mac、Linux解决端口被占用的问题
22 1
|
21天前
|
安全 Ubuntu Linux
Linux远程访问Windows实现步骤
在Windows上启用远程桌面连接并获取IP地址后,Linux用户需安装SSH客户端( Debian系:`sudo apt-get update; sudo apt-get install openssh-client`,RPM系:`sudo yum install openssh-clients`)。然后使用命令`ssh 用户名@Windows_IP地址`连接,其中`用户名`和`Windows_IP地址`按实际情况填写。
15 4
|
1月前
|
Linux 数据安全/隐私保护 Docker
linux和windows中安装emqx消息服务器
linux和windows中安装emqx消息服务器
41 0
|
1月前
|
弹性计算 安全 数据安全/隐私保护
远程桌面连接Windows实例,提示“为安全考虑,已锁定该用户账户,原因是登录尝试或密码更改尝试过多”错误解决方案
远程桌面连接Windows实例,提示“为安全考虑,已锁定该用户账户,原因是登录尝试或密码更改尝试过多”错误解决方案
207 0
|
1月前
|
Linux iOS开发 MacOS
|
1月前
|
安全 Linux 网络安全