TightVNC

De enunpimpam
Revisión del 00:56 29 abr 2020 de Nacho (discusión | contribuciones)
(dif) ← Revisión anterior | Revisión actual (dif) | Revisión siguiente → (dif)
Saltar a: navegación, buscar

Instalara

sudo apt-get update
sudo apt-get install tightvncserver

Para iniciar e

vncserver :1

Escribir the VNC password

Decir NO to view-only password

cd /home/pi
cd .config
mkdir autostart
cd autostart
nano tightvnc.desktop
  1. Enter the following lines:
[Desktop Entry]
Type=Application
   Name=TightVNC
  Exec=vncserver :1
 StartupNotify=false

Iniciar Script

Vamos a crear un script para que el tightvncserver se ejecute al iniciar

sudo nano /etc/init.d/tightvnc
#!/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='root'
### End customization required
eval cd ~$USER
case "$1" in
  start)
    su $USER -c '/usr/bin/tightvncserver :1'
    echo "Starting TightVNC server for $USER "
    ;;
  stop)
    pkill Xtightvnc
    echo "Tightvncserver stopped"
    ;;
  *)
    echo "Usage: /etc/init.d/tightvncserver {start|stop}"
    exit 1
    ;;
esac
exit 0

Podemos configurar la pantalla cambiando la siguiente lienea:

su $USER -c '/usr/bin/tightvncserver :1'
su $USER -c '/usr/bin/tightvncserver :1 -geometry 1280x800 -depth 24'

Cerramo nano y guradamos cambios ahora tenemos que cambiar los permisos del archivo para que pueda ser ejecutado

sudo chmod 0755 /etc/init.d/tightvnc

Comprobamos el funcionamiento del script

sudo /etc/init.d/tightvnc start

Comprobamos que podemos conectarnos mediante VNC

Ahora vamos a activar el script para que cuando se encienda el raspberry se auto ejecute

update-rc.d tightvnc defaults 99 

Nota:99 es el último en la lista de ejecución. Puedes bajar el número si lo crees conveniente).

Reiniciamos raspberry pi

sudo reboot