Mount OneDrive for Business on Headless Linux VPS through WebDav

Web Distributed Authoring and Versioning is an extension of the Hypertext Transfer Protocol that allows clients to perform remote Web content authoring operations.


2018.06.02 Since the rclone has support to mount the OneDrive for Business without root permission, it’s recommended to use it for more conveniently.


If the domain of your office365 account has been verified, you can use the API of OneDrive for Business with some client. See that on my previous post:

However, many schools don’t verify the domain, and the office365 accounts of these schools can apply online through the Microsoft website

When trying the API, these accounts will get the error:
Using application **** is currently not supported for your organization because it is in an unmanaged state. An administrator needs to claim ownership of the company by DNS validation of before the application *** can be provisioned.

Fortunately, we can mount OneDrive for Business through WebDav, the same way with the official OneDrive UWP on Windows 10. The way of authorising is cookie, not the normal username and password. As far as I know, the Konqueror, a GUI file manager on KDE, and davfs2, a WebDav command line tool, support to mount webdav server with cookie on Linux.


I will show the operations on Ubuntu 16.04.

Get OD4B Cookie

Login the office365 website. Choose “Stay signed in?” to “YES”, and keep the period of validity longer.
Press F12 or right click–>Inspect element–>Network to capture the traffic.
Open SharePoint or OneDrive app.

Select a HTTP request include *****, you can see the rtFa and FedAuth cookie that are required to authorize.

Get WebDav Link

Open a folder on OD4B website, copy the link on the Address Bar and URL Decode

Finally, the webdav link of root directory of OD4B:

Install Davfs2

Modify Davfs2 config

Mount OD4B

Chech Mounting Status

Upload File

You can operate the mounting folder (/home/test) like local folder.

Unmount OD4B

Shell Script

For easy use, you can use the simple shell script. If you want to mount multiple accounts, just repeat the operations or run the shell script repeatly.

Cookie Version

Auto Login Version


You can create a davfs2 image with Docker. The Image need to run with –cap-add SYS_ADMIN –device=/dev/fuse –security-opt apparmor:unconfined or –privileged.


mount.davfs: Mounting failed. 302 Found

Please make sure the link of OD4B is correct. Solution from #69

Reference linkļ¼š

12 Replies to “Mount OneDrive for Business on Headless Linux VPS through WebDav”

  1. Worked great! Does the cookie expire? Can I set this up as a persistent mount using say fstab? Thanks so much really great work!

    1. the cookie will expire without using about 2-3 weeks. You can try with fstab, but I recommend to mount with the rclone.

Leave a Reply

Your email address will not be published. Required fields are marked *