VNC設定

クライアントからリモートデスクトップできるようにVNCサーバの設定。

vncのパッケージのインストール

# yum install vncserver

xinetdの設定

/etc/servicesへVNCへ接続するためのポートを記述。
ここでは、解像度ごとに数種類登録しています。
また、ポート番号は、5900+ディスプレイ番号になります。

# Local services
vnc-800x600x24		5901/tcp	# vnc  800x 600 24 bit
vnc-1024x768x24		5902/tcp	# vnc 1024x 768 24 bit
vnc-1280x1024x24	5903/tcp	# vnc 1280x1024 24 bit

また、xinetdへサービスを登録するために、/etc/xinetdに以下のファイルを作成。
ここでは、3つの解像度用に3つ登録しています。

  • vnc-800x600x24
service vnc-800x600x24
{
	disable		= no
	socket_type	= stream
	wait		= no
	user		= nobody
#	group		= tty
	server		= /usr/bin/Xvnc
	server_args	= -inetd -geometry 800x600 -depth 24 -query localhost -once PasswordFile=/etc/vnc_passwd
	log_on_failure	+= USERID
}
  • vnc-1024x768x24
service vnc-1024x768x24
{
	disable		= no
	socket_type	= stream
	wait		= no
	user		= nobody
#	group		= tty
	server		= /usr/bin/Xvnc
	server_args	= -inetd -geometry 1024x768 -depth 24 -query localhost -once PasswordFile=/etc/vnc_passwd
	log_on_failure	+= USERID
}
  • vnc-1280x1024x24
service vnc-1280x1024x24
{
	disable		= no
	socket_type	= stream
	wait		= no
	user		= nobody
#	group		= tty
	server		= /usr/bin/Xvnc
	server_args	= -inetd -geometry 1280x1024 -depth 24 -query localhost -once PasswordFile=/etc/vnc_passwd
	log_on_failure	+= USERID
}

vncパスワードの設定

セキュリティのために、接続時にパスワードを入力するように設定。

# vncpasswd /etc/vnc_passwd
Password:
Verify:
# chmod 644 /etc/vnc_passwd

セキュリティ設定2

インターネット側から使えるとちょっと危険なのでLAN内に制限します。
制限する方法としては、hosts.allow,hosts.denyを使う方法と、サービスに記述する方法があります。
ここでは、hosts.allow,hosts.denyを使うことにします。
参照の順番は、hosts.allowが参照され、ここに記述がないものについては、hosts.denを参照して許可・不許可が決まります。
...allow、deny両方にないサービスは許可?
vncの設定は、、、

  • /etc/hosts.allow
#
# hosts.allow	This file describes the names of the hosts which are
#		allowed to use the local INET services, as decided
#		by the '/usr/sbin/tcpd' server.
#
Xvnc : 172.16.0.100
Xvnc : 172.16.1.
  • /etc/hosts.deny
#
# hosts.deny	This file describes the names of the hosts which are
#		*not* allowed to use the local INET services, as decided
#		by the '/usr/sbin/tcpd' server.
#
# The portmap line is redundant, but it is left to remind you that
# the new secure portmap uses hosts.deny and hosts.allow.  In particular
# you should know that NFS uses portmap!
ALL : ALL

gdm設定

最後に、gdmの設定。
gdmの設定ファイルでXDMCPを有効にします。

  • /etc/gdm/custom.conf
[xdmcp]
Enable=true

これで、クライアントからリモート接続できるはず。