How to automatically sync Google drive to a headless ubuntu server

Is there a way to have odrive on Ubuntu (or any Linux) automatically sync changes on a mounted path on Google Drive?

Or have a way to command the odrive to do it remotely, like via a web server CGI script?

I could only get it to do an odrive sync as a the same user that started the odrive agent as a fully logged in user. I can’t sudo or suid to that user. So I can’t get cron or the CGI script to trigger the sync.

When I try to do it with anything other than the fully logged in user that started the agent I get:

There was an error sending the command, please make sure odrive agent or desktop is running.

Any suggestions?

Hi @rberger,
If you are running the python-based CLI (, you can edit the file to get past this issue.

The CLI looks for a file in the user’s home folder. If you change this path to the folder of the user who is running the odrive agent, you should be able to send commands as another user (as long as the other user has access to the specified path).

Look at like 1147 in (look for AGENT_PORT_REGISTRY_FILE_PATH). Change expand_user('~') to '/home/username' or whatever path is appropriate on your system for the user that ran the agent.

Looks like that worked for me! Thanks. This is a big help.

Might be nice to make that a CLI parameter or an environment variable override.

1 Like