Skip to content

OneDrive Client Multi Account Configuration Assistance

abraunegg edited this page Sep 14, 2021 · 3 revisions

OneDrive Client Multi Account Configuration Assistance

The following information is written to assist folk who have multiple OneDrive accounts or SharePoint sites and wish to sync this data. This is an expansion on the details within the usage document on this topic.

Examples of multi-account / multi-configuration combinations are:

  • 2 x OneDrive Personal Accounts
  • OneDrive Personal Account and OneDrive Business / Office365 / School Account
  • OneDrive Personal Account and a SharePoint Drive
  • Many SharePoint drives

Client Configuration

The key to achieving this is the following:

  • Each account must use it's own unique configuration directory
    • Example: ~/.config/onedrive-PersonalAccount1
    • Example: ~/.config/onedrive-PersonalAccount2
    • Example: ~/.config/onedrive-Work
    • Example: ~/.config/onedrive-SharePointSiteName1
    • Example: ~/.config/onedrive-SharePointSiteName2
  • Each account must use it's own unique sync directory. This directory can be 'anywhere' on your system, it does not need to reside in your home directory:
    • Example: ~/OneDrive-Personal1
    • Example: ~/OneDrive-Personal2
    • Example: /usr/data/OneDrive-Work
    • Example: /usr/data/OneDrive-SharePointSiteName1
    • Example: /usr/data/OneDrive-SharePointSiteName2
  • Each unique configuration directory must contain a copy of the config file
    • Each configuration file, must have the 'sync_dir' value updated. Refer to the following example.
    • For each SharePoint site configuration file, the 'drive_id' value must be updated. Refer to the following document.
  • Configure any other required options within the 'config' file, for example
    • 'skip_dir' option
    • 'skip_file' option
    • 'skip_dotfiles' option
    • 'monitor_interval' option
  • Configure 'sync_list' if required for this account configuration
  • Configure 'business_shared_folders' if required for this account configuration

Client Operation

Once the client is correctly configured, test the configuration using the unique configuration directory for each account to ensure that the configuration is what you want:

  • Utilise --display-config
    • Example: onedrive --confdir="~/OneDrive-Personal1" --display-config
    • Example: onedrive --confdir="~/.config/onedrive-PersonalAccount2" --display-config
    • Example: onedrive --confdir="~/.config/onedrive-Work" --display-config
    • Example: onedrive --confdir="~/.config/onedrive-SharePointSiteName1" --display-config
    • Example: onedrive --confdir="~/.config/onedrive-SharePointSiteName2" --display-config
  • Test the client configuration with --dry-run
    • Example: onedrive --confdir="~/OneDrive-Personal1" --synchronize --verbose --dry-run
    • Example: onedrive --confdir="~/.config/onedrive-PersonalAccount2" --synchronize --verbose --dry-run
    • Example: onedrive --confdir="~/.config/onedrive-Work" --synchronize --verbose --dry-run
    • Example: onedrive --confdir="~/.config/onedrive-SharePointSiteName1" --synchronize --verbose --dry-run
    • Example: onedrive --confdir="~/.config/onedrive-SharePointSiteName2" --synchronize --verbose --dry-run
  • Run the client configuration to sync the configured account:
    • Example: onedrive --confdir="~/OneDrive-Personal1" --synchronize --verbose
    • Example: onedrive --confdir="~/.config/onedrive-PersonalAccount2" --synchronize --verbose
    • Example: onedrive --confdir="~/.config/onedrive-Work" --synchronize --verbose
    • Example: onedrive --confdir="~/.config/onedrive-SharePointSiteName1" --synchronize --verbose
    • Example: onedrive --confdir="~/.config/onedrive-SharePointSiteName2" --synchronize --verbose

Automating Client Operation

To enable automatic client operation, for each of the individual accounts configured, each account must have it's own unique systemd service file, and that systemd file updated with the correct confdir parameter.

Refer to the following within the usage document in regards to configuring the systemd files.

Linking back to ~/OneDrive

In some cases, it might be desirable, to have all the multi account data visible under your home directory 'OneDrive' folder. The simplest solution here is to create a symbolic link to the source data:

ln -s /home/alex/OneDrive-Personal1 /home/alex/OneDrive/OneDrive-Personal1
ln -s /home/alex/OneDrive-Personal2 /home/alex/OneDrive/OneDrive-Personal2
ln -s /usr/data/OneDrive-Work /home/alex/OneDrive/OneDrive-Work
ln -s /usr/data/OneDrive-SharePointSiteName1 /home/alex/OneDrive/OneDrive-SharePointSiteName1
ln -s /usr/data/OneDrive-SharePointSiteName2 /home/alex/OneDrive/OneDrive-SharePointSiteName2