sleathy03
Posts: 3
Joined: Thu Oct 22, 2015 12:50 pm

Vncserver on Boot

Thu Oct 22, 2015 1:09 pm

How do you set a vncserver to come on when you boot up the raspberry pi. I am trying to run my pi via my laptop. I have installed it but I have to connect my pi to a monitor to turn on the vncserver and then connect using the Ethernet cable, to run the vncserver off the pi to the laptop. Is there a way to have it so when you turn the pi on it automatically starts running the vncserver so I can just connect it straight away to the pi. :?: :?:

Please help me with this one.

User avatar
JRV
Posts: 270
Joined: Mon Apr 02, 2012 1:39 pm
Location: Minneapolis, MN

Re: Vncserver on Boot

Thu Oct 22, 2015 2:04 pm

I use this script to start a VNC session. VNC is not started until it is needed.

Code: Select all

#!/bin/sh

ssh -X -4 [USER_NAME]@[CLIENT_IP_ADDRESS] tightvncserver -geometry 1440x900
vncviewer [RPi_IP_ADDRESS]

xanthor
Posts: 10
Joined: Fri Oct 16, 2015 3:16 pm

Re: Vncserver on Boot

Thu Oct 22, 2015 2:40 pm

For Raspbian Jessie (with systemd), you can create a service:
viewtopic.php?f=66&t=123457

Also remember that SSH is enabled by default.

sleathy03
Posts: 3
Joined: Thu Oct 22, 2015 12:50 pm

Re: Vncserver on Boot

Thu Oct 22, 2015 3:37 pm

JRV wrote:I use this script to start a VNC session. VNC is not started until it is needed.

Code: Select all

#!/bin/sh

ssh -X -4 [USER_NAME]@[CLIENT_IP_ADDRESS] tightvncserver -geometry 1440x900
vncviewer [RPi_IP_ADDRESS]
So do I just have to type it once, because I am trying to get it so I don't have to connect to a monitor to start the vncserver every time. Also I am quite a beginner so where do I type it. :D

Thanks

User avatar
JRV
Posts: 270
Joined: Mon Apr 02, 2012 1:39 pm
Location: Minneapolis, MN

Re: Vncserver on Boot

Fri Oct 23, 2015 3:47 pm

Open your text editor on the client machine.
Copy that text into a text file.
Name it something easy to remember.
Open a terminal and make it executable with the command

Code: Select all

chmod +x [FILENAME]
and run it with the command

Code: Select all

./[FILENAME]

sleathy03
Posts: 3
Joined: Thu Oct 22, 2015 12:50 pm

Re: Vncserver on Boot

Fri Oct 23, 2015 6:50 pm

Ok Thank you so much.

stderr
Posts: 2178
Joined: Sat Dec 01, 2012 11:29 pm

Re: Vncserver on Boot

Fri Oct 23, 2015 7:20 pm

[quote="sleathy03] [/quote]
> So do I just have to type it once,
>
The first line is supposed to start the server and the second is supposed to connect to it. Does that actually work with the default configuration? Maybe it does but there are permissions that need to be right in X which are there to prevent people getting into your system.

> because I am trying to get it so I don't have to connect to a monitor
> to start the vncserver every time.
>
If you just want to run X apps off the RPi, you can also run ssh -X [email protected] program with the program you want, which is what the command line does in the example with vncserver. The application will just pop up on your local screen like a normal X program, assuming you are running X locally. Under Windows, perhaps try MobaXTerm or something like that. Lately I've been using X2Go in place of VNC, so look into other options.

Return to “General discussion”