Outlook feed
I was tossing around with Microsoft’s Microsoft 365 developer program some time ago (mainly because it was able to create 25 sub-users, and each user’s OneDrive is 5 TB. I thought it would be so big that I could use it as a network disk to store some data anywhere. It is advisable. Then use it in conjunction with your own VPS mounting) Now the Microsoft registered account comes with 5GB of space, we can use rclone to mount it a>, used as a local disk. linux server
1. Apply for OneDrive API
Go toMicrosoft Azure management interface, log in to your Microsoft account, and open the "Application Registration" service.
After successful registration, you will be redirected to the application home page. Note down the "Application (Client) ID" shown in the picture for future mounting.
Then click "Certificate and Password" → "Generate Client Password".
After adding the password, record the password value we just created for future mounting. Note that the password must be recorded here because it will only be displayed once.
Next, click "API Permissions" to obtain permissions for our API. Just check all the permissions in Files.
After completing this step, we will obtain the OneDrive API, andclient IDandpassword value.
2. Mount OneDrive network disk at startup
2.1 Obtain authentication token
can mount Windows and Linux. Demonstrate Linux (Ubuntu system) undermount OneDrive
Download rclone at corresponding to the operating system installation package. You need to log in later to obtain the token. My VPS does not have a browser, so I need to download and install the Windows version of rclone. .
- Download rclone under Windows system and unzip it, press win+R to call up the run, and enter "cmd".
- Enter cd + the decompressed folder path, enter the rclone folder, and then enter the following command to start authorization. (If it is win11, enter the directory, right-click and open it in the terminal)
Replace the ID and password with your own
rclone.exe or ( .\rclone.exe ) authorize "onedrive" "Client ID" "Password value"
At this point, the browser will automatically open, and logging in will authorize the API we just created.
If the page returns this after acceptance, it means success, and the console will return the token.
The token is retained first and will be used for binding later.
2.2 Install rclone
Install rclone on Ubuntu:
apt update
apt install curl && apt install fuse3
curl https://rclone.org/install.sh | sudo bash
After the installation is successful, enter rclone config on the command line to mount the OneDrive network disk, enter "n" to create a new cloud disk, and enter a name. This name is the name of the disk after it is mounted. I named it "OneDrive".
Next, look for the serial number corresponding to OneDrive. This serial number may change as the version is updated, so pay attention to read it clearly.
After entering the serial number, the previously savedClient ID, Password value a>.
Then there is the network disk type. Be careful to distinguish what type of network disk you have here. Most of them in China are (1), and some universities are using the Century Internet version (4).
Next, there will be no advanced configuration (n), nor automatic configuration (n).
Then we use the token we obtained above. We copy and fill the entire braces into .
After the configuration is completed, we select the type as OneDrive Personal or Business (1). Then select OneDrive (1). The system will read the network disk path. We enter y to confirm.
Finally, the program will also list the main information for you to confirm again:
At this time, we see that a "onedrive" type network disk named "OneDrive" has been created. We enter q to exit the program and prepare to mount this network disk to the local directory.
2.3 Download the rclone self-starting mounting script
- Download and edit the autostart script
wget -N git.io/rcloned
vim rcloned
- Modification content:
NAME="OneDrive" #rclone The name filled in during configuration REMOTE='/VPS' #Remote folder, a folder mounted in the network disk, leave it blank for the entire network disk LOCAL='/home/OneDrive' #Mount address, VPS local mounting directory
- Set up auto-start at power on
mv rcloned /etc/init.d/rcloned
chmod +x /etc/init.d/rcloned
update-rc.d -f rcloned defaults # Debian/Ubuntu
chkconfig rcloned on # CentOS
bash /etc/init.d/rcloned start
Just see . [信息] rclone 启动成功 !
View mounted disk
df -h
That’s it. If you encounter any problems, you can leave a comment and we’ll reply!
manage
Start mounting bash /etc/init.d/rcloned start
Stop mounting bash /etc/init.d/rcloned stop
Remount bash /etc/init.d/rcloned restart
View log tail -f /$HOME/.rclone/rcloned.log
Uninstall self-starting mount
bash /etc/init.d/rcloned stop
update-rc.d -f rcloned remove # Debian/Ubuntu
chkconfig rcloned off # CentOS
rm -f /etc/init.d/rcloned