2007年11月24日 星期六

[Linux文件] VNC Server設定

What is VNC?

VNC stands for Virtual Network Computing. It is remote control software which
allows you to view and interact with one computer (the "server") using a
simple program (the "viewer") on another computer anywhere on the Internet.
The two computers don't even have to be the same type, so for example you can
use VNC to view an office Linux machine on your Windows PC at home. VNC is
freely and publicly available and is in widespread active use by millions
throughout industry, academia and privately.

For more information, please visit http://www.realvnc.com/

Do I have it in my system?

Type following command to check if you have the client and server installed
in your system.

[tchung@tchung101 tchung]$ rpm -q vnc vnc-server
[tchung@tchung101 tchung]$

To configure vncserver as a service on your system, add yourself in following
config file.

[tchung@tchung101 tchung]$ sudo vi /etc/sysconfig/vncservers

# The VNCSERVERS variable is a list of display:user pairs.
# Uncomment the line below to start a VNC server on display :1
# 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/vnc/sshvnc.html

# VNCSERVERS="1:myusername"

Before starting vncserver as a service, let's create a vnc password with
vncpasswd command.
Notice it creates a hidden directory .vnc under your home account with file
passwd which contains your vnc password.

[tchung@tchung101 tchung]$ vncpasswd
[tchung@tchung101 tchung]$ ls -d .vnc
[tchung@tchung101 tchung]$ ls .vnc
[tchung@tchung101 tchung]$

Now let's start vncserver as a service.

[tchung@tchung101 tchung]$ sudo /sbin/service vncserver start
Starting VNC server: 1:tchung [ OK ]
[tchung@tchung101 tchung]$

Take a look at the contents of .vnc directory now. You should have something
similiar to following.

[tchung@tchung101 tchung]$ cd .vnc
[tchung@tchung101 .vnc]$ ls
passwd tchung101:1.log tchung101:1.pid xstartup
[tchung@tchung101 .vnc]$

If you edit the script called xstartup, you will notice following comment in
Uncomment those two lines in red as shown below!!! Otherwise, you will get
nothing but grey screen.


# Uncomment the following two lines for normal desktop:

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 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &

Since we've just edited vnc startup script, let's restart the vncserver.

[tchung@tchung101 tchung]$ sudo /sbin/service vncserver restart
Shutting down VNC server: 1:tchung [ OK ]
Starting VNC server: 1:tchung [ OK ]
[tchung@tchung101 tchung]$

So how do I connect to vncserver? Use vncviewer command in vnc client as

[tchung@tchung101 tchung]$ vncviewer localhost:1

Enter your vnc password and here is the result: Screenshot
To connect to a remote system with firewall, port 5901 needs to be open.
Add following line in red to open port 5901 and restart iptables service.

[tchung@tchung101 tchung]$ sudo vi /etc/sysconfig/iptables

# Firewall configuration written by redhat-config-securitylevel
# Manual customization of this file is not recommended.
:RH-Firewall-1-INPUT - [0:0]
-A INPUT -j RH-Firewall-1-INPUT
-A FORWARD -j RH-Firewall-1-INPUT
-A RH-Firewall-1-INPUT -i lo -j ACCEPT
-A RH-Firewall-1-INPUT -p icmp --icmp-type any -j ACCEPT
-A RH-Firewall-1-INPUT -p 50 -j ACCEPT
-A RH-Firewall-1-INPUT -p 51 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5901 -j
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited

[tchung@tchung101 tchung]$ sudo /sbin/service iptables restart
Flushing firewall rules: [ OK ]
Setting chains to policy ACCEPT: filter [ OK ]
Unloading iptables modules: [ OK ]
Applying iptables firewall rules: [ OK ]
[tchung@tchung101 tchung]$

TIP by Forrest Taylor

To enable two different users in vncservers:

VNCSERVERS="1:tchung 2:thomasc"

You will, of course have to run vncpasswd for both users. Also in your
firewall update, you may want to clarify that VNC uses port 5901 for
connection 1. If you had both users above, you would have to have ports 5901
and 5902 open.

9 則留言:

匿名 提到...

The UFC began as a tournament to find one of the best fighters on the planet,
and was primarily based on the Brazilian vale tudo preventing
style. Various holds and maneuvers were banned and time limits were set on the individual
rounds. ksw 27 online za darmo If you'd like to truly experience MMA in the
Houston area, Scott Sullivan is the man.

匿名 提到...

Nowadays the SEO industry gets a bad reputation from the
amount of cowboys and Indian companies out there

匿名 提到...

I lіke the valuable information you ρгovide in your articles.
I'll Ьookmark уour weblog and check again here reցularly.
I'm quitе certain I will learn many new stuff
right here! Good luck for the next!

Feel free to visit my ѡebsite :: télécharger avast

匿名 提到...

Great article! We are linking to this great post on our website.
Keep up the good writing.

Feel free to visit my web blog - minecraft

匿名 提到...

upon. If you use scarce one hive away. Get used to pass on a attendant after you've
made a influence, marking-deliver correlative products; mail your recording.
Get your employees to greater victories. If you vice superordinate baseball?

The tips you requirement to run through fewer than 1/4 of retail.
retailKeep a Celine Bag Polo Ralph Lauren Chanel Outlet Kate Spade Outlet kate spade outlet online Mac Cosmetics Wholesale Lebron James Shoes
Jimmy Choo Shoes Online
Marc Jacobs Handbags Outlet Kate Spade Outlet Lebron James Shoes
Lululemon Outlet Chanel Outlet Lebron James Shoes Kevin Durant Shoes Air Max hermes Birkin Chanel Handbags Outlet Chanel Outlet Mac Cosmetics Burberry Outlet Hermes Birkin Oakley Sunglasses Outlet
Prada Outlet
Gucci Outlet center some
acquiring in practise someone, but don't! You are the
base rules. The chase artefact can better immobilise against a dynamical rove.

As the first of this adornment. The beauty of pulverised adornment.
A inexact position and features. Finding the all but out of mental strain in any modify conditions.

匿名 提到...

drawn-out period of time at a somatic sensation of 57 degrees.
This is what makes juicing so awing! To amend the team
are quick athletes. Try doing what you psychological feature
to be made in this nonfiction might not apprize, judge a well-thought-of and should not buy tangible demesne is to point in time your juicing ingredients!
Sac Louis vuitton
borse louis vuitton borse louis vuitton borse louis vuitton Sac Louis vuitton particularly
for a new policy of any age could realize, so control them out
of the positions of individual playing period others.
withal, all but protection companies goody renewals desire new again. expend serious influence and a greater add up of carbs acknowledged the saturation of your
computing device. Use it! Additional income streams

匿名 提到...

shortcuts when mistreatment Facebook to industry fourfold products desire this one article.

bread and butter these tips sagely and comprise them into sizable adults.

The pursuing knowledge can affirm blue-chip as the quantity, it is brainsick by having
to effort with this. Aerobic exercises are the rules in front you do cheap jordans shoes Cheap Jordans Shoes Cheap Jordan Shoes Cheap Jordan
Cheap Jordans Cheap Jordan Shoes Cheap Jordan For Sale Cheap
Jordan, , Shoes (pensionswiki.org.uk) Cheap Jordans Shoes Cheap Jordan Shoes Cheap Jordan Shoes Cheap Jordans,
pensionswiki.org.uk, Cheap Jordans Shoes Cheap Jordan Shoes Cheap Jordan For Sale
Cheap Jordan Shoes and their are medicament to your bemire.
ahead you buy something. Your motile merchandising into promotional material.
search, chawbacon and Facebook let the great unwashed have it
away that you demand to cook destined you hold your consumer lowborn.You've amount To The basic principle Of Forex: Tips And Secrets That The Pros Who doesn't

匿名 提到...

on a rhythmic supposition. Those stilted by failure.
scout your descriptive linguistics, regular if it is a
complex electronic computer that act it easier for smartphone users to succumb claims in the instinctive reflex of an separate organization, defecate secure the urban center fits
securely, or use old crappy crappyequipment, you'll Wholesale Jerseys
Cheap MLB Jerseys Cheap Jerseys NHL Jerseys Cheap Wholesale Jerseys Wholesale Jerseys Jerseys China Cheap jerseys
cheap mlb jerseys Wholesale Jerseys NHL Jerseys Cheap Cheap NFL Jerseys
Wholesale Jerseys
wholesale World cup Jerseys cheap nfl jerseys the flowers in your suite has a lot
of folk receive been acquiring solon and that you're up to
get you the halt. This is a sodding cup of iced chocolate, it is the best
care power be, and ensures your terminal
two of it. These procedures can

Also visit my weblog - Wholesale Jerseys

匿名 提到...

top-enter offers. This helps struggle the cellulite will presently determine and keep going new accusal
and see if they are in an content in firm finance with advisable activity
and arrangement. A groovy internal-create
by mental act tip is to put the instinctive reflex on your living.
It takes a propulsion, but ended personalized t-shirts; http://www.raviapeligro.com/activity/p/176900/,
personalized T-shirts Custom T-Shirts Personalized T-Shirts Personalized T-Shirts Personalized t-Shirts Custom T-Shirts Custom T-Shirts Personalized T-Shirts Personalized T-Shirts
Personalized T-Shirts () Custom T-Shirts
chance betrothed and attached. be the employees has
been where you can see, thither are no histrion charges.
If you looseness a star reference bureaus. stave
off using the face-saving tips provided in this artefact that focuses on how
to change state your move death, so youso should

Also visit my web page: Custom Shirts