Setting up a VNC server

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
 
What I use is the net/tightvnc port.
Once it is installed you might start it as regular user with the command % vncserver
If this is the first time you start vncserver you must provide a password that will later be used when you log in with the VNC client.
In the output of vncserver command look for someting like
Code:
desktop is domain.host:2
This helps you to create the port number to connect from the client, in this case it is
Code:
domain.host:5902
Additional setup might be done in ~/.vnc/xstartup.

For launching at startup time please consult the rc(8) manpage.
For help about starting the server see the vncserver(1) manpage.
 
  • Thanks
Reactions: grz
You can set which port to use by starting vncserver(1) with the argument -rfbport so you don't have to scan through the logfile to find out.

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

Sourcing .bashrc is in order to get the $PATH variable correct. My ~/.vnc/xstartup 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.
 
Back
Top