Menu

Backyard Pi OneDrive

Overview

Security

I don’t recommend using this until rclone folks figure out how to reduce the level of permissions they need to get rclone to work. They’ve done it with other providers, but the current implementation for OneDrive (possibly due Microsoft not having more granular options when this rclone backend was written; in any event it will be discontinued soon and may not respond after sometime on June 2022 and in any event will not receive security or other fixes after that point) backend in rclone will soon stop working, and requires a scary level of access to your OneDrive.

Configuring the Pi

Create an rclone config

To create an new rclone remote as the motion user, execute:

sudo -H -u motion rclone config

choosing Microsoft OneDrive as the backend and answering the prompts appropriately.

If you are running ‘headless’ (that is without graphical interface and can’t use a browser on the Pi) you will need to follow the instructions for remote authorization, which requires you to issue an rclone command on a computer which does have a browser in order to authenticate with Microsoft.

Add a copymotion script

A copymotion script for copying to a remote web server directory when using the above autocopy configuration in /etc/motion/motion.conf

Copy this script to /usr/local/bin/copymotion

#!/bin/sh

( rclone copy /var/lib/motion/data onedrive-motion:/motion & )

NB This script assumes you have configured the destination for videos and photos to be /var/lib/motion/data NOT /var/lib/motion (which is the default). This is because the rclone config lives in /var/lib/motion/.config and we do not want to copy it a public OneDrive folder.