Autostart OneDrive for Linux client

NethServer Version: 7.9.2009

Hi all… been struggling with this for a few days, it’s time to concede defeat and ask for some help. I’m trying to get the abraunegg onedrive client to synchronise my local file shares with OneDrive.

Following the instuctions, everything works great when starting the program manually, but it seems like it can’t read the config properly when run as a service.

Details:

  • Config files and authorisation tokens stored in /etc/onedrive/scans. Owner of all directories and files is root
  • Logged in as root, running ‘onedrive --monitor --confdir="/etc/onedrive/scans/"’ works as expected. Client does not ask to be reauthorised and proceeds to pick up where it left off after it was last closed
  • I’ve created a custom service /etc/systemd/system/sharepoint-scans.service per the template provided, with the line ExecStart=/usr/local/bin/onedrive --monitor --confdir="/etc/onedrive/scans/"
    and commented out a couple of options that were causing errors when running systemctl enable sharepoint-scans
  • systemctl start sharepoint-scans attempts to start the service, but the log reports that the process fails because it wants to be authorised again… which is generally a sure sign that the config file is not being read.

I am not super confident with administering Linux systems (hence using NS…) and don’t really understand the way that privileges/escalation works… but I thought that the service would run the process as root, so if the manual command worked as root there shouldn’t be any difference in the way that it starts?

Sorry, I’m totally lost - willing to hear any suggestions.
Thanks!

@firmfoit

Hi Tim

Never used OneDrive, but check the following:

Config files containing Auth / Access info usually MUST be 600 permissio.
Only root can read, no group or anyone.

My 2 cents
Andy

Thanks Andy… I just had a look, the auth token is 600 permissions and owner is root. Just for giggles I changed it to 644, when I manually execute the onedrive command it reverts them back to 600.

When I set it to 644 and then start the service, the file is not changed; it’s almost like the service doesn’t have access to the /etc/onedrive/scans folder, but I can’t see why not :frowning:

1 Like

/etc/onedrive/scans/

Try maybe with the config one level higher, eg /etc/onedrive/ or even directly under /etc/

Using rsync, I have the password file /etc/rsync_passwd.txt there…

If that doesn’t work, I’m at a loss, maybe something (MS) special with Onedrive…

:slight_smile:

My 2 cents
Andy

Hehe… welcome to my party of the lost.

Have tried moving the folder, and have tried recreating the folder and config from scratch in a different location (.config/scans) without success. It needs to be in its own folder when synchronising more than one library.

Also just to be clear the Onedrive for Linux project is not the work of Microsoft, it’s a open source product that works really well… normally.

Might be time to see how stable (or not…) NS8 is on Debian :rofl:

1 Like

For future reference, this turned out to be a bug in the OneDrive for Linux client app, which the developer has now fixed.