Under Linux, install Rclone, mount Google Drive, OneDrive, WebDAV, FTP, etc.; copy and backup files to each other, etc.

888u

Last update at :2024-07-10,Edit by888u

Rclone, under Linux, can mount Google Drive, OneDrive, WebDAV, FTP, etc. It is a magical tool. Below is an installation and usage tutorial.

1. Install Rclone The following operations are based on Centos system

1. Install necessary applications

yum -y install wget unzip screen fuse fuse-devel

2. Install Rclone

curl https://rclone.org/install.sh | sudo bash

or

wget https://downloads.rclone.org/rclone-current-linux-amd64.zip unzip rclone-current-linux-amd64.zip mv rclone-v* rclone cdrclone

2. Mount Google Drive

1. Mount GDrive

rcloneconfig

Choose n to create a new link and name it gdrive. Then select Google Drive

Leave client_id and client_secret blank and press Enter, select 1 for SCOPE, leave root_folder_id and service_account_file blank and press Enter, select n for Edit advanced config and Use auto config

At this time, a link will appear, copy it into the browser, obtain the authorization code, and paste the authorization code into the terminal. Select according to the prompts, usually n, y, q

Mount Google Drive to a directory on the server. To facilitate future web access, you can mount it to /www/wwwroot/ (the following demonstration is /www/wwwroot/gdrive.xxx.com, gdrive.xxx.com is changed to your own domain name)

./rclone mount gdrive: /www/wwwroot/gdrive.xxx.com --allow-other --allow-non-empty --vfs-cache-mode writes

2. Set up rclone to start at boot

First copy the rclone executable file to /usr/bin:

cp /root/rclone/rclone /usr/bin/rclone

Create a new rclone.service file:

vi /usr/lib/systemd/system/rclone.service

Paste:

[Unit] Description=rclone ​​ [Service] User=root ExecStart=/usr/bin/rclone mount gdrive: /www/wwwroot/gdrive.xxx.com --allow-other --allow-non-empty --vfs-cache-mode writes Restart=on-abort ​​ [Install] WantedBy=multi-user.target

Reload the daemon to make the new service file take effect:

systemctl daemon-reload

Start rclone:

systemctl start rclone

Set up startup:

systemctl enable rclone

3. Operation of Rclone

1. List the remote directory (gdrive was created before)

rclone lsd gdrive

2. Copy files

rclone copy source file/directory target directory

The source file/directory and target directory must have absolute paths, which can be servers, network disks, etc. If you want to save the Gdrive shared by others, you can save it to your own network drive first, and then copy these files to your own network drive to prevent the person who shared it from deleting the files.

rclone copy gdrive:gongxiang/japan gdrive:gongxiang/self

3. Synchronize files

rclone sync source file/directory target directory

This only synchronizes files that are not available. Suitable for files with large changes.

Recommended site search: What is needed for website registration, domain name resolution IP address query, IP detailed address query, host server rental, instant solution server, mainland China agent IP, yellow pages, top ten free servers abroad, mainland China registration-free CDN, Korea cheap server,

Under Linux, install Rclone, mount Google Drive, OneDrive, WebDAV, FTP, etc.; copy and backup files to each other, etc.

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码