首页 > 代码库 > 使用windows调用Linux远程桌面
使用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
打开后如下图所示
我们需要把上图中 “x-window-manager &” 这一行注释掉,然后在下面加入一行 “gnome-session &” ,或者是 “startkde &” ,分别表示要启用 GNOME 桌面或 KDE 桌面。以 GNOME 桌面为例,修改后如下图所示:
具体修改步骤:打开文件后,点击 insert 按钮,这时就可以输入了,在 “x-window-manager &” 前加 “#”,然后回车输入 “gnome-session &”,然后点击 “Esc ” 退出编辑模式,输入 “:wq!”保存修改即可)
我的机器:
[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 &
七。登陆成功
本文出自 “飞奔的小GUI” 博客,请务必保留此出处http://9237101.blog.51cto.com/9227101/1932907
使用windows调用Linux远程桌面