远程连接Redhat Linux配置

主机环境: RedHat  Enterprise Linux 5
客户机:     Win 7


如果没有安装,使用如下语句安装
# yum install vnc vnc-server -y


使用VNC
1. 启动VNCSERVER,第一次启动会提示输入密码。
[oracle@localhost /]$ vncserver
You will require a password to access your desktops.
Password: 123456            #输入vnc 连接密码
Verify: 123456                 #确认vnc密码

xauth: creating new authority file /home/oracle/.Xauthority

New ‘localhost.localdomain:2 (oracle)’ desktop is localhost.localdomain:2

Creating default startup script /home/oracle/.vnc/xstartup
Starting applications specified in /home/oracle/.vnc/xstartup
Log file is /home/oracle/.vnc/localhost.localdomain:2.log

注意:每个用户都可以启动自己的VNCSERVER远程桌面,同时每个用户可以启动多个VNCSERVER远程桌面,它们用ip加端口 号:ip:1、ip:2、ip:3 来标识、区分,使用同一端口会使另外登录的用户自动退出。

另,VNCSERVER的大部分配置文件及日志文件都在用户home目录下.vnc目录下。

用户可以自定义启动号码如:

[oracle@localhost /]$ vncserver :2        #注意:2前面一定要有空格。
A VNC server is already running as :2


2.. 配置gnome环境
你的RH使用的什么图形模式这个一般只有登录到图形界面查看一下才能知道,或者通过ps -A命令列出所有当前运行的程序,看看有没有KDE或者gnome字样来判断一下。

如果你是gnome桌面,那么你需要修改~/.vnc/xstartup的配置文件。


[oracle@localhost .vnc]$ vi xstartup

#!/bin/sh
# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER        #将此行的注释去掉
# exec /etc/X11/xinit/xinitrc        #将此行的注释去掉
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &
gnome-session gnome           #添加这一句是连接时使用gnome 桌面环境
twm &

设置修改完毕最好是重启一次系统,否则设置不会生效。我采用的方法是杀死VNCSERVER进程再重运行VNCSERVER。

[
oracle@localhost .vnc]$ vncserver -kill :1      #这里你启动vncserver时是什么端口号要对应上。
[
oracle@localhost .vnc]$ vncserver :1           #重启VNCSERVER,注意:1前面一定要有空格。


3. 设置分辨率
[root@localhost: ~]#vi /etc/sysconfig/vncservers

# `man vncviewer’ manual page.

VNCSERVERS=”1:oracle”            #此处添加用户,一般只添加一个就行了。
VNCSERVERARGS[1]=”-geometry 1024×768 -nolisten tcp -nohttpd -localhost”

4. 常用命令
修改密码 vncpasswd
启动VNC  vncserver :1
停止VNC  vncserver -kill :1


使用Xmanager (待续。。。)

VNC虽然方便,可以在IE里直接调用,但是需要配合SSH tunneling加密才够安全(密码很容易被sniffer tools抓到,例如大名鼎鼎的Cain ),且速度太慢。

原文地址:https://www.cnblogs.com/wait4friend/p/2349952.html