CentOS5 vnc server 設定


<< トッ プページへ

概要

VNC(Virtual Network Computing)は、リモートマシンのデスクトップをネットワークを介して遠隔操作できるソフトです。
(※注意 管理を怠るとPCを乗っ取られる可能 性がありま す!)

■ 設定

/etc/sysconfig/vncserversに下のように追記する。
「rootユーザのデスクトップを画面番号1として1024x768の解像度で公開する。」と言う意味になります。

# vi /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
# <URL:http://www.uk.research.att.com/archive/vnc/sshvnc.html>.

# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.

# Use "-nohttpd" to prevent web-based VNC clients connecting.

# 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 -nohttpd -localhost"
VNCSERVERS="1:root"
VNCSERVERARGS[2]="-geometry 1024x768 -nolisten tcp -nohttpd"


# vncpasswd
    Password: (パスワードを打ち込む)
    Verify: (再度打ち込む)

とやると、.vncと言うディレクトリが作成されます。次にxstartupというファイルを
作成します。

$ cd
$ cd .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
export LANG=ja_JP.ujis
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
export GTK_IM_MODULE=scim
gnome-session &
exec gnome-session &

# chmod 755 xstartup

vnc上でatokを使用できるようにします。こんな 感じに編集する。

$ 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
export LANG=ja_JP.ujis
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
export XMODIFIERS="@im=htt"
export HTT_DISABLE_STATUS_WINDOW=t
export HTT_GENERATES_KANAKEY=t
export HTT_USES_LINUX_XKEYSYM=t
export GTK_IM_MODULE=iiim
/usr/lib/im/httx -if atokx2 -xim htt_xbe &
#twm &
exec gnome-session &

使用方法

そして[アプリケーション]−[システム設定]−[サーバ設 定]− [サービス]でvncserverにチェック を入れて再起動します。クライアントのほうも、Fedora Coreであれば[アプリケーション]−[インターネット]−[リモート デスクトップ接続]で接続先のIPアドレスと画面番号をコロン(:)で分けて指定すれば(例:192.168.0.1:1)がvncpasswdで設定し たパスワードを聞いてくるので入力すれば日本語のデスクトップが表示されます。
もちろん外部からの操作を可能にするためにはルーターのポートを開放する必要があります。





Copyright©2005-2006  熊の巣  All Right Reserved.  管理人へメール