VNC remote access Raspberry Pi 3 (including boot)

Raspberries come in VNC installation requires the use of the command line. If you need to install the remote operation VNC, SSH must log in to the command-line interface (Raspbian default user name is: pi, the default password is: raspberry).

installation

Command line:

sudo apt-get install tightvncserver

After installing, be sure to use this command to set a VNC password:

vncpasswd

(First input operation password twice, and then asks whether to set a View (view-only) code, according to their likes, usually is not necessary.)

Set boot

Set boot, you need to create a file in /etc/init.d/. For example tightvncserver:
(Note: The name of the startup script, program name and have the same habits)

sudo nano /etc/init.d/tightvncserver

(Recommended nano, the same comes, vi do not know why you can not paste)

#!/bin/sh
### BEGIN INIT INFO
# Provides:          tightvncserver
# Required-Start:    $local_fs
# Required-Stop:     $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start/stop tightvncserver
### END INIT INFO

# More details see:
# http://www.penguintutor.com/linux/tightvnc

### Customize this entry
# Set the USER variable to the name of the user to start tightvncserver under
export USER=' PI ' 
### End Customization required 

eval cd ~ $ the USER 

Case  " $ 1 "  in 
  Start) 
    # boot command line. Here custom resolution, the console number, or other parameters. 
    SU $ the USER -C ' / usr / bin / tightvncserver -geometry 800x600 -depth 16:. 1 ' 
    echo  " Starting $ TightVNC Server for the USER " 
    ;; 
  STOP) 
    # line termination command. Here console is consistent with the start number. 
    SU $ the USER -C ' / usr / bin / tightvncserver -kill:. 1 ' 
    echo  " tightvncserver stopped " 
    ;;
   * )
     echo "Usage: /etc/init.d/tightvncserver {start|stop}"
    exit 1
    ;;
esac
exit 0

 (Note: The value of the variable USER default user name, here is pi.)

Ctrl + O and then Enter to save,

Then Ctrl + X to exit the text editor.

Then add execute permissions to the file tightvncserver:

sudo  chmod  755 /etc/init.d/tightvncserver

And update the boot list:

sudo update-rc.d tightvncserver defaults

Restart Raspberry Pi:

sudo shutdown -r now

Manual start

If you do not want to configure automatic startup script, each time you use VNC SSH needs to start, use the following command:

tightvncserver -geometry 800x600 :1

 If the first start, and never use vncpasswd command to set a password, the program will be asked to set a password. Boot easily, so it is recommended to boot.

 Command parameters:
a,: 1, number specified console.
  Start multiple consoles, can provide multiple desktop environment affect each other. If you do not add this parameter, tightvncserver will automatically find the next available console 1 from the start. Plus this parameter will be forced to use the specified console, the console has been started if this error. Add this parameter can effectively prevent inadvertent activation program multiple times (starts multiple console) wasted system resources.
  Special number --0 0 console console monitor is connected to the real true output of the desktop image. For the VNC client, do not enter the port number to log, then log on to the default 0 console and convenient. But because the number 0 is the real desktop, the desktop environment and start-up conflict. So the configuration tutorial start automatically, use the No. 1 console.
Two, -geometry 800 × 600, resolution. I can not add.

 Termination VNC Console:

tightvncserver -kill :1

VNC client login

Download-Viewer VNC: http://www.realvnc.com/download/viewer/
login address input "IP Address: The console number" 0 numbers do not add the console.

other

Later I discovered that the system comes with VNC, but need to start their own

Visible Raspberry Pi 3B VNC remote settings (including start-up)

 

 

Reference Links: https://blog.csdn.net/lu_embedded/article/details/50621203

Guess you like

Origin www.cnblogs.com/lfri/p/11784877.html
Recommended