赞
踩
转载请注明来源:http://blog.csdn.net/greenlight_74110/article/details/78623025
su
yum install -y xrdp vnc-server
在文件的末尾添加如下两行:
vim /etc/sysconfig/vncservers
VNCSERVERS="1:john"
VNCSERVERARGS[1]="-geometry 1280x720"
VNCSERVERS="2:july"
VNCSERVERARGS[2]="-geometry 800×600 -depth 24 -nolisten tcp -nohttpd -localhost"
说明:
VNCSERVERS 这一行是配置在系统启动时启动几个 VNC server,上面的例子里运行了三个 VNC server,其中 john 在 display :1(对应于5901),july 在 display :2(对应于5902)。访问时使用xxx.xxx.xxx.xx:1或者xxx.xxx.xxx.xx:2访问即可。
VNCSERVERARGS 这三行,分别为 VNC server 1, 2配置启动参数,上面的例子里对 john 使用屏幕分辨率 1024×768,对 july 使用 800×600,24 色,不支持 tcp,不支持 http 连接,只能在本地测试访问。
授予用户登录权限:
vim /etc/group
假设允许用户“john”、“cat”远程登录,禁止用户“pig”远程登录。在文件末尾处添加:
john:250:john
cat:x:250:cat
pig:x:501:
首先要回到相应的用户权限下。
获得相应用户的权限:
su john
设置用户远程登录密码:
vncpasswd
注:每个授予远程登录权限的用户,都要完成此项操作!
在iptables中添加端口列外
-A INPUT -p tcp -m tcp --dport 5901:5903 -j ACCEPT #for the vncserver
-A INPUT -m state --state NEW -m tcp -p tcp--dport 3389 -j ACCEPT #for the xrdp
(option)或者也可以关闭防火墙
(option)查看防火墙状态
service iptables status
(option)关闭防火墙
service iptables stop
chkconfig off
(option)或者直接将服务器上的防火墙删除
chkconfig --del iptabels (服务内删除iptables)
完成以上操作后需要重启防火墙
service iptables restart
设置让 xrdp 和 vncserver 随开机加载启动。
chkconfig xrdp on
chkconfig vncserver on
vncserver :1
vncserver -kill :1
service vncserver status
service vncserver start
service vncserver stop
service vncserver restart
service xrdp status
service xrdp start
service xrdp stop
运行如下命令,可以看到3389端口:
netstat -tnlp |grep xrdp
windows下在“运行”中输入mstsc,即可打开远程连接程序
linux下用remote desktop client且访问方式设置为xrdp,直接输ip地址即可访问。但如果要用vncviewer,记得在ip地址后面加端口号(可以是1,2….也可以是5901,5902,….)。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。