OneDrive Account on a Linux  – OneDrive, Microsoft’s distributed storage service is a really famous offering with regards to distributed storage services. OneDrive empowers us to get to our documents at whatever time, anyplace, on every one of our gadgets. However, there is one big caveat – no official Linux customer is accessible. Therefore, Linux users have to rely on the web version (which does not provide syncing), or on unofficial clients. There used to be a working informal customer named onedrive-d, be that as it may, it did not keep up anymore. Having said that, there is another unofficial OneDrive client appropriately named onedrive by GitHub user skilion. It has support for manual and automatic sync, real-time file monitoring and resumable uploads. Although the set up involves some tinkering and using the command line, it works well enough for daily usage and does not pose problems.  In this way, on the off chance that you are hoping to match up your OneDrive information with your Linux PC, here’s the means by which to do it:

[ad type=”banner”]

Note: This program has been tested under Linux Mint 18. These instructions will work unmodified with Ubuntu 16.04. While getting it to work with other distributions is possible, we haven’t covered it in this article.

Installing OneDrive on Linux:

Open the Terminal, and run the following commands to install the prerequisite software libcurl, libsqlite, build-essential, and git:
sudo apt-get install libcurl4-openssl-dev libsqlite3-dev build-essential git

After the installation is complete, run the following commands to install the compiler for the D programming language:

  1. sudo wget http://master.dl.sourceforge.net/project/d-apt/files/d-apt.list -O /etc/apt/sources.list.d/d-apt.list
  2. wget -qO – http://dlang.org/d-keyring.gpg | sudo apt-key add –
  3. sudo apt-get update && sudo apt-get install dmd-bin

 

We will now download and install the onedrive software. In your Home directory, download the source code using the following command:

git clone https://github.com/skilion/onedrive.git onedrive_code

 

Now, compile and install the software:

 

cd onedrive_code

make

sudo make install

And you are done.

Configuring Your OneDrive Account:

To configure your OneDrive account for the first time, open the Terminal, and run onedrive. You will see a prompt with a URL like this:

How to Sync Your OneDrive Account on a Linux Computer)

Simply copy this URL, and enter it in your web browser of choice. You will be asked for your Microsoft account and password. Once entered, you will get the following screen:

How to Sync Your OneDrive Account on a Linux Computer)

[ad type=”banner”]

Select Yes here, and copy the URL that appears on the following screen:

How to Sync Your OneDrive Account on a Linux Computer)

Now paste this URL in your Terminal window, and press Enter. You will notice that it automatically starts syncing your OneDrive account with the Onedrive folder in your home directory. If you have several gigabytes of data stored in your OneDrive account, be patient because this is going to take a while.

How to Sync Your OneDrive Account on a Linux Computer)

             

Basic Usage

Whenever you want to sync your local storage with your OneDrive account on Linux, simply run the command onedrive from your terminal. As a demonstration, I deleted some images from my OneDrive storage using the web app. On my Linux system, I created a text file in the Onedrive folder. Running the command onedrive gives me the following result:

How to Sync Your OneDrive Account on a Linux Computer)

Setting Up Automatic Sync:

If you wish to automatically keep your OneDrive account in sync, instead of running the command manually every time, you can enable the systemd service. In a terminal, run:
systemctl --user enable onedrive
systemctl --user start onedrive

There is a caveat here. Adding or removing files from your local filesystem reflects the changes in your OneDrive account almost instantly. However, the other way round is slightly delayed. This is not a big deal for most people, but can be a problem if you transfer a lot of files regularly.

If you are not sure whether or not a certain file synced or not, you can check the logs. To do that, run:

journalctl –user-unit onedrive -f

How to Sync Your OneDrive Account on a Linux Computer)

Excluding Files and Folders from Syncing:

Let’s say you have a folder filled to the brim with HD videos in your OneDrive account, and you want to avoid syncing that, as it will take up significant bandwidth and space. Maybe you also want to avoid syncing disc images (.iso files). To do this, open the file ~/.config/onedrive/config using your favorite text editor, and modify the skip_file and skip_dir sections accordingly:

skip_file = ".*|~*|*.iso"

skip_dir = “.*|Videos”

If you are running the sync service, then you need to turn it off first:
systemctl --user stop onedrive

After that, run onedrive with the resync option:
onedrive --resync


you can re-enable the sync service:
systemctl --user start onedrive

 [ad type=”banner”]

Use OneDrive Seamlessly with Linux

Another good Linux OneDrive client to consider is rclone. While it only offers manual sync, it has certain additional features not present in onedrive, such as support for simultaneous, multiple cloud accounts, including, but not limited to OneDrive, Google Drive, Dropbox, Amazon S3 and Yandex. You can get rclone here.Well, that’s how you can sync a Microsoft OneDrive account with Linux.

Categorized in: