-
Notifications
You must be signed in to change notification settings - Fork 3
VNC and File Sharing
Instructions gleaned from Adafruit and 4DC5, but customized for my own setup.
$ sudo apt-get update
$ sudo apt-get install tightvncserver
$ vncserver :1
It will ask you to enter an 8-character password the first time you run it. You can test by connecting a VNC client like Screens.
- Name: Tiki Nook
- Address or Hostname: tikinook.local
- Port: 5901
- Operating System: Linux
- Authentication type: VNC Password
- Password: ••••••••
$ cd /home/pi
$ cd .config
$ mkdir autostart
$ cd autostart
$ nano tightvnc.desktop
In nano, type the contents of the file:
[Desktop Entry]
Type=Application
Name=TightVNC
Exec=vncserver :1
StartupNotify=false
Type ^X
then Y
to save the changes.
$ sudo apt-get install netatalk
From your Mac, in the Finder, hit ⌘K
. Enter afp://192.168.10.14
(using the IP address of your Pi).
I am not sure if this is strictly necessary, or if it does trigger some default data for file sharing?
On the RPi:
$ sudo apt-get install avahi-daemon
$ sudo update-rc.d avahi-daemon defaults
$ sudo nano /etc/avahi/services/afpd.service
In nano, type out (or paste in) this XML data:
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">%h</name>
<service>
<type>_afpovertcp._tcp</type>
<port>548</port>
</service>
</service-group>
Then save (^X
then Y
) and back on the command line:
$ sudo /etc/init.d/avahi-daemon restart
You should now be able to see the Pi in the Finder sidebar.
We've already installed it, but we need to set up the service to be seen by Bonjour. This will create the script that will launch the server.
$ cd /etc/init.d
$ sudo nano tightvncserver
The contents of the file:
#!/bin/bash
# /etc/init.d/tightvncserver
#
# Carry out specific functions when asked to by the system
case "$1" in
start)
su pi -c '/usr/bin/vncserver -geometry 1200x900'
echo "Starting VNC server "
;;
stop)
pkill vncserver
echo "VNC Server has been stopped (didn't double check though)"
;;
*)
echo "Usage: /etc/init.d/blah {start|stop}"
exit 1
;;
esac
exit 0
Save and exit.
$ sudo chmod +x tightvncserver
$ sudo pkill Xtightvnc
$ ps aux | grep vnc
Check that the VNC server is not running. (How? Should it not show in the list at all?)
$ sudo /etc/init.d/tightvncserver start
$ cd /etc/init.d
$ sudo update-rc.d tightvncserver defaults
$ sudo nano /etc/avahi/services/rfb.service
File contents:
<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">%h</name>
<service>
<type>_rfb._tcp</type>
<port>5901</port>
</service>
</service-group>
Then run:
$ sudo /etc/init.d/avahi-daemon restart
Now you should be able to see the Screen Share option for the RPi in your Finder sidebar.