Setting up a VNC server

Discussion related to network/web services such as Apache, BIND Sendmail, etc.

Setting up a VNC server

Postby agottem » 16 Nov 2011, 15:48

I've searched the forums and Google, but haven't been able to find a good tutorial on setting up a VNC server. I'm new to FreeBSD, so I apologize in advance if there's good documentation out there that I've missed.

Here's what I'd like to do: upon startup, I'd like my FreeBSD server to start a VNC server I can connect to remotely via SSH. I'm worried about doing it incorrectly, and introducing security risks.

Thanks,
Andrew
agottem
Junior Member
 
Posts: 26
Joined: 28 Dec 2009, 22:18
Location: Chicago, USA

Postby izotov » 17 Nov 2011, 09:34

What I use is the [port]net/tightvnc[/port] port.
Once it is installed you might start it as regular user with the command [cmd=%]vncserver[/cmd]
If this is the first time you start [file]vncserver[/file] you must provide a password that will later be used when you log in with the VNC client.
In the output of [file]vncserver[/file] command look for someting like
Code: Select all
desktop is domain.host:2
This helps you to create the port number to connect from the client, in this case it is
Code: Select all
domain.host:5902

Additional setup might be done in [FILE]~/.vnc/xstartup[/FILE].

For launching at startup time please consult the [man=8]rc[/man] manpage.
For help about starting the server see the [pman=1]vncserver[/pman] manpage.
izotov
Member
 
Posts: 118
Joined: 02 Feb 2010, 07:35
Location: Budapest, Hungary

Postby stralle » 17 Nov 2011, 13:27

You can set which port to use by starting [pman=1]vncserver[/pman] with the argument [FILE]-rfbport[/FILE] so you don't have to scan through the logfile to find out.

I have a [man=8]rc.subr[/man] script that does the following as its final thing when fed the start argument in order to have the vnc server start automatically:
[cmd=%]su user -c ". /home/user/.bashrc; /usr/local/bin/vncserver -rfbport 5900 -geometry 1152x870 -depth 16 -alwaysshared -name $(hostname -s)"[/cmd]

Sourcing [file].bashrc[/file] is in order to get the $PATH variable correct. My [file]~/.vnc/xstartup[/file] then simply contains the command to start my windowmanager of choice.

By using portforward through an ssh client, I can connect to this vnc server wherever I can ssh out from by simply connecting to localhost:5900 and the ssh tunnel does the rest.
stralle
Junior Member
 
Posts: 5
Joined: 17 Nov 2011, 12:54

Postby agottem » 18 Nov 2011, 00:03

Both your replies were very useful. Thanks for the help!
agottem
Junior Member
 
Posts: 26
Joined: 28 Dec 2009, 22:18
Location: Chicago, USA


Return to Web & Network Services

Who is online

Users browsing this forum: No registered users and 1 guest