Herbaldew
Posts: 9
Joined: Wed Feb 07, 2018 2:59 pm
Location: US Mid-Atlantic

Changing RealVNC Port via SSH

Tue Feb 13, 2018 12:23 am

Does anyone know how to or even if this can be done?

All I can find is:

Code: Select all

vncserver rfbport=xxxx
which changes the virtual server but not the real server.

Not sure if the terminology I used is correct but when I did the above and connected with the VNC Viewer, it was a small screen and the cursor was an X and wouldn't do much as opposed to the normal hookup which is full function and full screen.
Last edited by Herbaldew on Tue Feb 13, 2018 5:55 am, edited 1 time in total.

brianinmaine
Posts: 3
Joined: Mon Feb 12, 2018 4:29 am

Re: Chaning RealVNC Port via SSH

Tue Feb 13, 2018 5:47 am

not sure what you're trying to do? I use port forwarding from ssh to tunnel my vnc connection like this:

Code: Select all

ssh -R 5900:localhost:5900 pi@192.168.1.100
then I can open my vncviewer to localhost:5900 and get a full desktop?
Is that right?

see more here: https://www.techrepublic.com/article/ho ... orwarding/

Herbaldew
Posts: 9
Joined: Wed Feb 07, 2018 2:59 pm
Location: US Mid-Atlantic

Re: Changing RealVNC Port via SSH

Tue Feb 13, 2018 5:55 am

Thanks for the reply.

When you are at the Pixel desktop and click on the VNC icon --> Options --> Connections --> Connectivity --> Port: xxxx.... I am trying to set that port number via ssh before I log in the first time with VNC.

brianinmaine
Posts: 3
Joined: Mon Feb 12, 2018 4:29 am

Re: Changing RealVNC Port via SSH

Tue Feb 13, 2018 7:01 am

Ah - you're trying to change the default listening port from 5900 to something else? According to the manual: https://www.realvnc.com/en/connect/docs ... r-ref.html
you were right about the parameter to change I think?

Code: Select all

RfbPort

Platform	Subscription	Default value
All	Enterprise	5900
Specify a number between 1 and 65535 representing an available TCP port on which VNC Server can listen for direct connections. Note that ports 1 to 1024 are restricted by some operating systems.

This parameter is ignored if AllowTcpListenRfb is FALSE.

The default port, 5900, is registered for use by VNC Server with the Internet Assigned Numbers Authority (IANA), and does not need to be explicitly identified by connecting VNC Viewer users.
I think parameters can be changed in /etc/vnc/config or /etc/vnc/config.custom? Not a bunch of info on this, not sure why you'de even want to do this? An ssh tunnel is pretty secure, are you trying to obfuscate?

Herbaldew
Posts: 9
Joined: Wed Feb 07, 2018 2:59 pm
Location: US Mid-Atlantic

Re: Changing RealVNC Port via SSH

Tue Feb 13, 2018 4:45 pm

brianinmaine wrote:
Tue Feb 13, 2018 7:01 am
I think parameters can be changed in /etc/vnc/config or /etc/vnc/config.custom?
That's the right tree to bark up and what I had been experimenting with (along with the .vnc folder) with no joy. I queried RealVNC Support and although their reply didn't work either, it gave me enough information to figure it out.

In case anyone else lands here looking to do this:

Connect to the rpi via ssh and before enabling VNC, create the following file:

Code: Select all

sudo nano /etc/vnc/config.d/vncserver-x11
Enter:

Code: Select all

RfbPort=xxxx (where xxxx is the port you wish to use)
and save.

Now when VNC Server is enabled it will be listening on the port you entered.

Return to “Networking and servers”

Who is online

Users browsing this forum: orcunbaslak and 20 guests