Raspberry Pi

Submitted by admin on

Raspberry Pi

Notes on my experiments with a Raspberry Pi.

Development and Remote Access


  • Use a static IP address although perhaps could use DNS on \\RASPBERRYPI somehow


  • Enable SSH via RaspiConfig
  • Use PuTTy and save session
  • Setup private keys
    • Use Rpi keygen and copy to Windows Putty then import
  • To setup a NEW rpi with existing keys
    • Use WinSCP to copy public key back to pi
    • cat your_public_key >> .ssh/authorized_keys

X Windows


  • Install an X Server on Windows
  • Run in one of two ways:
  1. Native windows in Windows:
    1. Use Putty with rsa keys and X11 forwarding (localhost:0)
  2. Whole-screen login
    1. Use Xming to login graphically. Not as good as you need password (?)

Samba - Share a drive with Windows

Was a bit tricky with permissions etc. There are many guides under rpi samba share

  • apt-get install libcups2 samba samba-common cups
  • edit /etc/samba/samba.conf
  • I added the following although just using [home] might also work
wins support=yes			
   comment= Pi Home			
   read only=no			
   only guest=no			
   create mask=0755			
   directory mask=0755			
  • Add Samba users (independent from linux users) with
smbpasswd -a samba-pi-user
  • Check samba users with
pdbedit -L

Daemons and Services

Make a daemon:

cp /etc/init.d/skeleton /etc/init.d/timelapse
vi /etc/init.d/timelapse # see code notes below
sudo update-rc.d timelapse defaults # installs
  • Use man page for start-stop-daemon.
  • Generally annoying to pipe stderr/stdout to a LOGFILE using the bash -- shell syntax as the PIDFILE file holds the bash process not the child process. Stopping the service doesn't kill the child process.
  • Seems better to use a --logfile as an option to your daemon. Python stdout=stderr=open(file) is really easy here.
  • Use --background is not ideal but easier than forking inside the daemon
  • Carefully to prerequistes (eg MySQL)

The bash-redirect style is below. Note the change of user group:

start-stop-daemon --group adm --chuid $USER --start --background --verbose --make-pidfile --pidfile $PIDFILE  --exec /bin/bash -- -c $DAEMON $DAEMON_ARGS > $LOGFILE 2>&1 || return 2

The preferred method is:

start-stop-daemon --group adm --chuid $USER --start --background --verbose --make-pidfile --pidfile $PIDFILE  --exec $DAEMON $DAEMON_ARGS --logilfe $LOGFILE || return 2

Add / Remove a service:

 sudo update-rc.d -f timelapse defaults			
update-rc.d -f apache2 remove			
update-rc.d apache2 stop 80 0 1 2 3 4 5 6  # this prevent upgrades re-installing	 apparently.