Motion on the Fonera 2.0
- create a script to be executed when a movement is detected, to:
- upload the picture to our web server
- send an email (or create a script on the web server to send an email when the picture is uploaded)
- create a php script on the web server to access the uploaded pictures
~/.ssh$ dropbearkey -t rsa -f id_rsa ~$ dbclient -y -i ~/.ssh/id_rsa user@ip ~$ scp -S dbclient -i ~/.ssh/id_rsa fileName user@ip:/dir
- on_event_start scp_file "%Y-%m-%d %T"
- change to suit your needs:
- Destination server
- Don't change anything below this line
echo -e "This is an automated message generated by motion.\n\nMotion detected: $1\n\n" | $SCP -s "$SUBJECT" $TO
ssh -nNT -R -D546 remote.mydomain.com
I wrote a little about tunneling (forward and reverse) back in February. In this case, I'm going to tunnel SSH over a reverse SSH connection -- that is, I'm going to SSH from my inside box (NetBSD) to the web server (betaweb.h-i-r.net), and tell SSH to open a reverse tunnel port (2222) on the web server that connects to the SSH port on the NetBSD box (localhost:22). The -g option allows any remote host to use the tunnel. Otherwise, it will bind only to the localhost interface.
[axon@NetBSD]$ ssh email@example.com -g -R 2222:localhost:22 Last login: Sun Nov 30 14:13:08 2008 from netbsd.labs.h-i-r.net [firstname.lastname@example.org]$
Now, from anywhere in the world that can access port 2222 on betaweb.h-i-r.net, I can SSH through my home NAT to get to the internal NetBSD box:
Chimera:~ axon$ ssh -oPort=2222 email@example.com Password: [my password] Last login: Tue Oct 14 19:01:57 2008 from localhost NetBSD 4.0.1 (GENERIC) #0: Wed Oct 8 01:06:02 PDT 2008 Welcome to NetBSD!
scp -S dbclient -i /root/.ssh/dbkey.rsa motion.log roberto@server:/dir/. -P 222