There are lots of cloud storage solutions available, some of them run by independent companies like Dropbox or Copy, while others come from operating system providers like Google (Google Drive), Apple (iCloud) and Microsoft (OneDrive). Syncing these cloud storage services with Linux can be hit or miss, depending on the level of support provided.
Dropbox has good support for Linux, as does Copy. Traditionally Microsoft’s services are very tightly integrated with its own products, and as such, there isn’t a Linux sync agent provided by Microsoft. We have previously shown you a bypass that allows you to access OneDrive from Linux. Now, thanks to a project called onedrive-d, you can officially sync your OneDrive with Linux.
The first step to installing onedrive-d is to open a terminal window and clone the source code from git using the following command:
git clone https://github.com/xybu92/onedrive-d.git
If you don’t have “git” installed, you can install it with the command:
sudo apt-get install git
Now change directory into the onedrive-d folder:
And run the install script:
Enter your Ubuntu password if prompted. The installation script will download and install any dependencies via “apt-get”. Accept the list of packages to install.
Once the installation has completed, the settings dialog will appear.
Click “Connect to OneDrive.com” to authenticate. Enter your OneDrive username and password on the “Sign in” dialog.
You will then be asked to accept the permissions for onedrive-d so that it can “Access and edit your OneDrive” and “Access your info anytime.” These are necessary for onedrive-d to perform the sync operations.
Next click on “(None)” in the dropdown box just below where it says “The local folder to sync with your OneDrive.” Click “Other…” and use “Create Folder” on the file open dialog to create a new folder called “OneDrive.” Select the “OneDrive” directory as the sync folder.
To finish, click on “Close” and then on “Yes” to confirm that you want to save your preferences. The onedrive-d daemon doesn’t run automatically at system boot, so you need to start it manually by typing the following in a terminal window:
The output from the process will report what the onedrive-d daemon is doing, and you will get notifications on your desktop when the daemon updates files in your OneDrive folder.
If you need to change the settings then type the following into a terminal window:
This will display the settings dialog we saw earlier. Among the settings are a set of exclusions. When enabled, these tell onedrive-d not to sync certain types of files:
- Microsoft Windows only files (e.g. “Desktop.ini”)
- Apple Mac OS X only files (e.g. “.DS_Store”)
- Linux temporary files (e.g. “hello.c~”) – note the “~” at the end of the filename marking it as a backup or temporary file.
- Vi temporary files (e.g. “hello.c.swp”)
- Emacs temporary files (e.g. “#hello.c#”) – note the”#” at the beginning and the end of the filename.
There is also a onedrive-d command line tool called “onedrive-cli.” It allows you to perform certain low level file functions on your OneDrive storage. For example, to create a new folder called “important” on your OneDrive, type:
onedrive-cli mkdir important
This will create the folder directly on your OneDrive, and then as the onedrive-d daemon performs its synchronization, it will also be created in your local OneDrive folder.
To copy a file not in your local OneDrive folder to the “important” folder from above, type:
onedrive-cli put myimportantfile.doc important
Where “myimportantfile.doc” is the name of the file and “important” is the name of the directory from the example above. In time the file will be downloaded into your local OneDrive folder. It will also be accessible from onedrive.com.
Of course, the simplest way to add files to your OneDrive is to copy them into your local OneDrive folder and let onedrive-d upload them to the cloud.
The onedrive-d project is still very much under development, and there were times when I needed to restart the onedrive-d daemon to get it working again. However the basic synchronization seems to be working, and future versions should be more stable.
If you have any trouble with the instructions given above, feel free to use the comments section below to ask a question. If you are having any problems with onedrive-d, there is also an issue tracker where you might find help if other people have encountered the same issue.