How to sync Microsoft OneDrive with Linux

OneDrive is Microsoft's cloud-based storage service. Although it fits perfectly with the Windows platform, OneDrive will also connect to machines running on the Linux platform very easily.

Open source enthusiasts love to have a cloud-based storage device. Companies like Google, Amazon, Dropbox and Microsoft offer reliable products for free. This means that these companies will scan or read user files to comply with legal requirements or to serve ads. That is the reality of life, but this does not mean that users should not use these cloud storage services.

OneDrive is Microsoft's cloud-based storage service. Although it fits perfectly with the Windows platform, OneDrive will also connect to machines running on the Linux platform very easily. There are several ways to do this. Let's learn how to synchronize Microsoft OneDrive with Linux through the following article!

Instructions for syncing Microsoft OneDrive with Linux

  1. Install Onedrive
    1. For Ubuntu
    2. For Fedora
    3. For Arch Linux
  2. Setting
  3. Configuration
  4. Selective synchronization
  5. Start Onedrive when logging in

Install Onedrive

Onedrive is a CLI-based client, allowing users to sync quickly and easily with OneDrive.

To install Onedrive, first install some dependencies and set up git. Go to Terminal and enter one of the following commands.

For Ubuntu

 sudo apt install libcurl4-openssl-dev git sudo apt install libsqlite3-dev 

If you are using Ubuntu 18.04 and above, use snap to install dmd:

 sudo snap install --classic dmd && sudo snap install --classic dub 

If not, use the following command:

 sudo wget http://master.dl.sourceforge.net/project/d-apt/files/d-apt.list -O /etc/apt/sources.list.d/d-apt.list sudo apt-get update && sudo apt-get -y --allow-unauthenticated install --reinstall d-apt-keyring sudo apt-get update && sudo apt-get install dmd-compiler dub 

For Fedora

 sudo yum install libcurl-devel git sudo yum install sqlite-devel curl -fsS https://dlang.org/install.sh | bash -s dmd 

For Arch Linux

 sudo pacman -S curl sqlite dlang git 

Setting

After installing dependencies, fetch files with git:

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

Compile and install it:

 cd onedrive make sudo make install 

After doing this, users now need to authorize Onedrive with Microsoft so that it can access the account. Just enter the following information in Terminal:

 onedrive 

And the user will be prompted to access the URL to receive authorization.

How to sync Microsoft OneDrive with Linux Picture 1How to sync Microsoft OneDrive with Linux Picture 1

Log in to your OneDrive account and authorize the application to access your account.

How to sync Microsoft OneDrive with Linux Picture 2How to sync Microsoft OneDrive with Linux Picture 2

Once this is done, an empty white page will appear. Copy the URL and paste it into Terminal at the command prompt.

How to sync Microsoft OneDrive with Linux Picture 3How to sync Microsoft OneDrive with Linux Picture 3

Onedrive will start downloading all files in the cloud to the local directory.

Configuration

Users can find the 'config' file in the 'onedrive git' folder . To enable it, move it to the '~ / .config / onedrive /' directory.

 mkdir -p ~/.config/onedrive cp ~/onedrive/config ~/ .config/onedrive/config 

Open the file 'config'. There are two configuration options: 'sync_dir' and 'skip_files'.

  1. sync_dir: The location for storing OneDrive files. All files placed in or deleted from this folder will be synchronized with the cloud.
  2. skip_files: File type (or file template) is not synchronized.

After making the changes, save and restart Onedrive.

Selective synchronization

If you prefer to use the selective sync feature rather than synchronizing the entire OneDrive folder, users can create a file named 'sync_list' and place it in the '~ / .config / onedrive' folder. Inside the file add the relative path (from the synchronized OneDrive folder) to the files or folders you want to sync.

Start Onedrive when logging in

By default, Onedrive does not start when users log on. To make it automatically run when logged in, users can use systemd:

 sudo systemctl --user enable onedrive sudo systemctl --user start onedrive 

Or just add Onedrive to the startup application.

Now OneDrive will sync with the Linux system.

Hope you are succesful.

4.2 ★ | 17 Vote