Microsoft OneDrive是一种流行的云存储服务,允许您从任何设备存储和访问重要文件。不过,值得注意的是,OneDrive并不提供对Linux 的(Linux)官方支持。幸运的是,您可以通过多种方式在Linux系统上访问和同步OneDrive文件。
本文指导您通过各种方法将OneDrive与Linux环境集成。通过这些方法,您可以在Linux文件系统中无缝访问和管理OneDrive文件。

可以在 Linux 上使用 OneDrive 吗?
是的,您可以通过几种不同的方式在Linux上访问和使用(Linux)OneDrive 。虽然没有适用于Linux的官方(Linux)OneDrive客户端,但有几种非官方的替代方案可用。
例如,您可以使用适用于Linux(Linux)的开源非官方OneDrive客户端或 rclone 等命令行工具。您还可以从网络浏览器快速
访问OneDrive文件。(OneDrive)
请记住(Remember),这些都是非官方解决方案;您的体验可能会有所不同,具体取决于工具和您的Linux 发行版(Linux distribution)。无论如何,这些选项允许您将(Regardless)OneDrive集成到您的Linux工作流程中。
使用适用于Linux的(Linux)非官方 OneDrive 客户端(Unofficial OneDrive Client)
适用于 Linux 的非官方 OneDrive 客户端(unofficial OneDrive client for Linux)允许您在Linux系统上访问和使用OneDrive。请注意, (Please)Microsoft不以任何方式支持此非官方客户端— 您需要自行承担使用它的风险。
虽然未得到官方支持,但适用于Linux的(Linux)OneDrive客户端是一个免费、开源且维护良好的选项,可供Linux用户使用。
安装适用于Linux的(Linux)非官方 OneDrive 客户端(Unofficial OneDrive Client)
按照以下步骤在 Debian 或基于 Ubuntu 的Linux系统上下载并安装适用于Linux的(Linux)非官方 OneDrive(Unofficial OneDrive)客户端。其他发行版可能需要遵循不同的说明(follow different instructions)。
- 在 Linux PC 上打开终端。
- 在终端中输入以下内容以添加正确的存储库和存储库密钥以安装必要的软件包:
wget -qO – https://download.opensuse.org/repositories/home:/npreining:/debian-ubuntu-onedrive/xUbuntu_22。 10/发布.key | gpg –dearmor |sudo tee /usr/share/keyrings/obs-onedrive.gpg > /dev/null
- 该命令成功运行后,运行以下命令: echo “deb [arch=$(dpkg –print-architecture)signed-by=/usr/share/keyrings/obs-onedrive.gpg] https://download.opensuse.org /repositories/home:/npreining:/debian-ubuntu-onedrive/xUbuntu_22.10/ ./” | sudo tee /etc/apt/sources.list.d/onedrive.list

- 通过键入 sudo apt update 更新包管理器并等待其完成。
- 更新包管理器后,在终端中运行 sudo apt install —no-install-recommends —no-install-suggests ldc onedrive 并等待其完成。

- 如果在安装过程中遇到 libphobos2-ldc-shared100 依赖项错误,请运行 wget http://launchpadlibrarian.net/619487666/libphobos2-ldc-shared100_1.30.0-1_amd64.deb && sudo dpkg -i /libphobos2-ldc-shared100_1。 30.0-1_amd64.deb 首先解决它,然后重复 sudo apt install 命令。
配置和使用客户端
至此,您应该已经成功安装了非官方的Linux OneDrive客户端。接下来您需要对其进行配置才能访问您的文件。
- 要首次运行客户端并生成默认配置文件,请在终端中键入 onedrive。
- 系统将提示您访问Microsoft URL以进行身份验证并授予对您的 OneDrive 帐户的访问权限。在 Web 浏览器中打开URL ,使用您的(URL)Microsoft凭据登录,并授予必要的权限。

- 授予权限后,您将看到一个空白页面 - 复制URL,将其粘贴回终端,然后按Enter键。

- 如果成功,客户会提醒您。要开始同步,请在终端中输入 onedrive –synchronize。这应该开始将您的 OneDrive 文件同步到本地文件夹(默认情况下为 ~/OneDrive)。您需要留出时间来完成此过程。
- 如果您希望客户端在后台运行,请从终端键入并运行 onedrive –monitor。

有关客户端功能和设置的更多信息,您可以参考GitHub上客户端的官方文档(official documentation for the client)。
如何使用 Rclone在Linux上(Linux Using Rclone)访问 OneDrive(Access OneDrive)
rclone 是一个功能强大的开源终端工具,用于在 Linux PC 上跨本地或远程系统同步和传输文件。通过使用 rclone,您可以设置 Linux PC 以允许访问 OneDrive 存储。
要在Linux上将 rclone 与(Linux)OneDrive结合使用,请按照以下步骤操作。
- 首先,在Linux系统上下载并安装(Linux)Rclone。您可以在rclone 网站(rclone website)上找到特定发行版的安装说明或输入 sudo -v ;卷曲 https://rclone.org/install.sh | sudo bash 进入终端来快速安装它。

- 安装Rclone(Rclone)后,在终端中输入 rclone config 以启动配置过程。
- 出现提示时,选择 n 键创建新的遥控器,然后输入 OneDrive 遥控器的名称(例如 onedrive)。

- 接下来,找到作为存储提供商的Microsoft OneDrive(Microsoft OneDrive)编号(通常为 31),输入该编号,然后按Enter确认。

- 对于客户端 ID 和客户端密码,请留空并按Enter。
- 选择OneDrive(OneDrive)的身份验证区域(通常按 1 并按 Enter 键),然后选择 n 以使用典型的设置过程进行身份验证。

- 出现提示时,按 Y 打开 Web 浏览器进行登录。输入(Enter)您的 OneDrive 帐户详细信息并按照屏幕上的说明授权Rclone访问您的 OneDrive 帐户和存储。

- 配置完成后,关闭浏览器并返回终端。
- 选择您的OneDrive配置 - 通常为 1 用于标准OneDrive访问。按Enter键继续。

- 从提供的选项中选择您的 OneDrive ID,通常按 1 并按Enter键。

- 再次按 y 确认。

- 至此,配置应该完成了。按 Y(Press Y)再次确认并将其设为默认配置。

- 按(Press)q 退出配置工具。您可以使用 rclone 命令与 OneDrive 文件进行交互。例如,要列出 OneDrive 帐户的内容,请在终端中运行命令 rclone ls onedrive:。

- 要从 OneDrive 帐户下载文件,请在终端中运行命令 rclone copy onedrive: /path/to /file /path/to将/path/to路径替换为文件位置以及您想要在本地 PC 上保存文件的位置。
- 要将文件上传到OneDrive帐户,请运行命令 rclone copy /path/to /local/file onedrive: /path/to /remote/directory。/path/to路径替换为文件位置以及要将文件上传到的OneDrive存储中的位置。(OneDrive)

- 您还可以使用 rclonesync 命令同步OneDrive帐户和本地Linux文件系统之间的所有文件。例如,要将OneDrive帐户中的所有文件同步到名为 ~/onedrive 的本地目录,请运行命令 rclonesync onedrive: ~/onedrive。
- 要将 OneDrive 帐户中的特定目录同步到本地目录,请运行命令 rclonesync onedrive: /path/to /remote/directory /path/to /local/directory 并将/path/to路径替换为正确的远程和本地目录。

如何使用Web 浏览器(Web Browser)访问Linux(Linux Using)上的OneDrive(Access OneDrive)
不想安装任何附加软件?您可以使用 Web 浏览器从Linux(Linux) PC快速访问 OneDrive 文件。
为此,请访问 OneDrive 网站并使用你的(visit the OneDrive website)Microsoft帐户登录。登录后,您将看到包含文件夹和文件的 OneDrive 存储。您将能够下载文件、上传新文件、删除整个文件或文件夹,或者直接创建新的Office文件并将其添加到 OneDrive 存储中。

您还可以通过选择文件并按“共享”(Share)按钮与其他人共享您的文件。

请记住,对(Remember)OneDrive网站上的文件和文档所做的更改将与连接到你的Microsoft帐户的任何其他设备同步。
管理您的 Linux 文件
可以使用上述工具之一(或使用OneDrive网站)在(OneDrive)Linux上使用OneDrive。尽管Microsoft不提供适用于Linux的本机(Linux)OneDrive应用程序,但这些替代方案提供了类似的体验。
担心您的文件吗?请记住(Remember)保持文件备份自动化(keep your file backups automated),确保您的数据保持安全和最新。请注意可能出现的潜在 OneDrive 同步问题(potential OneDrive sync issues),如果遇到问题,请务必仔细检查您的设置。
How to Access and Use OneDrive on Linux
Microsoft OneDrive іs a popular clоud storage serviсe that allows you to store and access your important files from any device. However, it’s worth noting that OneDrive doesn’t offer оffiсial support fоr Lіnux. Luckily, there are several ways for you to access and synchronize your OneDrive files on a Linυx system.
This article guides you through various methods to integrate OneDrive with your Linux environment. With these methods, you can access and manage your OneDrive files seamlessly within your Linux file systems.

Can You Use OneDrive on Linux?
Yes, you can access and use OneDrive on Linux in a few different ways. While there isn’t an official OneDrive client for Linux, several unofficial alternatives are available.
For instance, you can use an open-source, unofficial OneDrive client for Linux or a command-line tool like rclone instead. You can also access your OneDrive files quickly from your web browser.
Remember that these are unofficial solutions; your experience might vary depending on the tool and your Linux distribution. Regardless, these options allow you to integrate OneDrive into your Linux workflow.
Using the Unofficial OneDrive Client for Linux
The unofficial OneDrive client for Linux allows you to access and use OneDrive on Linux systems. Please note that this unofficial client isn’t supported by Microsoft in any way—you’ll need to use it at your own risk.
While it’s not officially supported, the OneDrive client for Linux is a free, open-source, and well-maintained option for Linux users to use.
Installing the Unofficial OneDrive Client for Linux
Follow these steps to download and install the Unofficial OneDrive client for Linux on a Debian or Ubuntu-based Linux system. Other distributions may need to follow different instructions.
- Open the terminal on your Linux PC.
- Type the following into the terminal to add the correct repository and repository keys to install the necessary packages:
wget -qO – https://download.opensuse.org/repositories/home:/npreining:/debian-ubuntu-onedrive/xUbuntu_22.10/Release.key | gpg –dearmor | sudo tee /usr/share/keyrings/obs-onedrive.gpg > /dev/null
- Once that command successfully runs, run this command: echo “deb [arch=$(dpkg –print-architecture) signed-by=/usr/share/keyrings/obs-onedrive.gpg] https://download.opensuse.org/repositories/home:/npreining:/debian-ubuntu-onedrive/xUbuntu_22.10/ ./” | sudo tee /etc/apt/sources.list.d/onedrive.list

- Update your package manager by typing sudo apt update and wait for it to complete.
- Once your package manager is updated, run sudo apt install —no-install-recommends —no-install-suggests ldc onedrive in the terminal and wait for it to complete.

- If you run into a libphobos2-ldc-shared100 dependency error during installation, run wget http://launchpadlibrarian.net/619487666/libphobos2-ldc-shared100_1.30.0-1_amd64.deb && sudo dpkg -i /libphobos2-ldc-shared100_1.30.0-1_amd64.deb to resolve it first, then repeat the sudo apt install command.
Configuring and Using the Client
At this point, you should have successfully installed the unofficial Linux OneDrive client. You’ll need to configure it next to access your files.
- To run the client for the first time and generate the default configuration file, type onedrive into the terminal.
- You’ll be prompted to visit a Microsoft URL to authenticate and grant access to your OneDrive account. Open the URL in a web browser, sign in with your Microsoft credentials, and grant the necessary permissions.

- After granting permissions, you’ll see a blank page—copy the URL, paste it back into the terminal, and press the Enter key.

- The client will alert you if you were successful. To start synchronisation, type onedrive –synchronize into the terminal. This should start synchronizing your OneDrive files to a local folder (~/OneDrive by default). You’ll need to allow time for this process to complete.
- If you want the client to run in the background, type and run onedrive –monitor from your terminal.

For more information on the client’s features and settings, you can refer to the official documentation for the client on GitHub.
How to Access OneDrive on Linux Using Rclone
rclone is a powerful, open-source terminal tool for synchronizing and transferring files across local or remote systems on a Linux PC. By using rclone, you can set up your Linux PC to allow access to your OneDrive storage.
To use rclone with OneDrive on Linux, follow these steps.
- To get started, download and install Rclone on your Linux system. You can find the installation instructions for your specific distribution on the rclone website or type sudo -v ; curl https://rclone.org/install.sh | sudo bash into the terminal to quickly install it instead.

- Once Rclone is installed, type rclone config into the terminal to initiate the configuration process.
- When prompted, select the n key to create a new remote, and then enter a name for your OneDrive remote (such as onedrive).

- Next, locate the number for Microsoft OneDrive as the storage provider (typically 31), type it in, and press Enter to confirm.

- For client id and client secret, leave blank and press Enter.
- Choose your authentication region for OneDrive (typically by pressing 1 and hitting enter), then choose n to use the typical setup process to authenticate.

- When prompted, press Y to open a web browser to sign in. Enter your OneDrive account details and authorize Rclone to access your OneDrive account and storage by following the on-screen instructions.

- After the configuration is complete, close the browser and return to the terminal.
- Choose your OneDrive configuration—typically 1 for standard OneDrive access. Press the Enter key to continue.

- Choose your OneDrive ID from the options provided, typically by pressing 1 and hitting the Enter key.

- Press y again to confirm.

- At this point, the configuration should be complete. Press Y to confirm again and make it your default configuration.

- Press q to exit the configuration tool. You can use the rclone command to interact with your OneDrive files. For instance, to list the contents of your OneDrive account, run the command rclone ls onedrive: in your terminal.

- To download a file from your OneDrive account, run the command rclone copy onedrive:/path/to/file /path/to/local/directory in the terminal. Replace the /path/to paths with the file location and the location where you’d like to save the file on your local PC.
- To upload a file to your OneDrive account, run the command rclone copy /path/to/local/file onedrive:/path/to/remote/directory. Replace the /path/to paths with the file location and location in your OneDrive storage that you’d like to upload the file to.

- You can also use the rclone sync command to synchronize all of the files between your OneDrive account and your local Linux filesystem. For example, to synchronize all files in your OneDrive account to a local directory called ~/onedrive, run the command rclone sync onedrive: ~/onedrive.
- To synchronize a specific directory in your OneDrive account to a local directory, run the command rclone sync onedrive:/path/to/remote/directory /path/to/local/directory and replace the /path/to paths with the correct remote and local directories.

How to Access OneDrive on Linux Using Your Web Browser
Don’t want to install any additional software? You can quickly access your OneDrive files from a Linux PC using your web browser.
To do this, visit the OneDrive website and sign in with your Microsoft account. Once you sign in, you’ll see your OneDrive storage with folders and files. You’ll be able to download files, upload new ones, remove entire files or folders, or create new Office files directly and add them to your OneDrive storage.

You can also share your files with others by selecting the file and pressing the Share button.

Remember that changes made to files and documents on the OneDrive website will be synchronized with any other devices connected to your Microsoft account.
Managing Your Linux Files
Using OneDrive on Linux can be achieved using one of the tools above (or by using the OneDrive website). Although Microsoft doesn’t offer a native OneDrive application for Linux, these alternatives provide a similar experience.
Worried about your files? Remember to keep your file backups automated, ensuring your data stays secure and up to date. Be mindful of potential OneDrive sync issues that could arise, and always double-check your settings if you run into problems.