在Mac/Centos上使用rclone掛載OneDrive網(wǎng)盤
關(guān)于平時(shí)我們可以通過掛載FTP來增大mac/win/linux硬盤空間掌挚。也可以使用rclone掛載OneDrive/Google Drive/Amazon Drive等云存儲(chǔ)床三,同時(shí)還支持全平臺(tái)神妹,意味著您可以在Windows、Mac OS据某、Linux上進(jìn)行使用,本文將講述掛載FTP阴幌,和onedrive坯认,本人在測(cè)試googledrive 時(shí)會(huì)timeout,原因大家都懂得政恍。
前提說明:服務(wù)器上CentOS大部分未安裝圖形界面汪拥,rclone掛載必須要在有內(nèi)置瀏覽器的電腦才能正常完成授權(quán),因此我們要在本地Windows/Mac電腦安裝rclone并獲取授權(quán)后的token篙耗,再將其復(fù)制到CentOS的服務(wù)器上迫筑。剛好也可以證明支持全平臺(tái)。
Linux 掛載FTP
1鹤树、 安裝CurlFtpFS
centos系統(tǒng)
1铣焊、yum -y install epel-release && yum -y install curlftpfs
ubantu系統(tǒng)
apt-get install curlftpfs -y
2、掛載FTP
# 創(chuàng)建目錄罕伯,路徑及名稱 mkdir /home/tmp # 掛載FTP curlftpfs yourserver.com /home/ftp -o user=username:password
參數(shù)說明
yourserver.com #FTP地址
/home/ftp #本地目錄
username #FTP用戶名
password #FTP密碼
3曲伊、 檢查
輸入df -h
命令查下是否掛載成功
linux 通過rclone掛載onedrive
mac 安裝rclone
默認(rèn):在本地mac電腦上下載rclone,下載地址:二進(jìn)制
參考 githubgithub地址
通過 終端命令行下載
cd && curl -O https://downloads.rclone.org/rclone-current-osx-amd64.zip
解壓
unzip -a rclone-current-osx-amd64.zip && cd rclone-*-osx-amd64
創(chuàng)建目錄并移動(dòng)rclone
sudo mkdir -p /usr/local/bin
sudo mv rclone /usr/local/bin/
配置獲取token
初始化配置
rclone config
顯示結(jié)果
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n
name> onedrive #注意后面要用到
Type of storage to configure.
Choose a number from below, or type in your own value
e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> n
name> remote
Type of storage to configure.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
...
19 / Microsoft OneDrive
\ "onedrive"
...
Storage> 19 #根據(jù)自己到版本選擇
Microsoft App Client Id - leave blank normally.
client_id> #enter
Microsoft App Client Secret - leave blank normally.
client_secret> #enter
Remote config
Choose OneDrive account type?
* Say b for a OneDrive business account
* Say p for a personal OneDrive account
b) Business
p) Personal
b/p> p #這里選擇個(gè)人版追他,你想掛載Business就選擇b
Use auto config?
* Say Y if not sure
* Say N if you are working on a remote or headless machine
y) Yes
n) No
y/n> n #選擇n
For this to work, you will need rclone available on a machine that has a web browser available.
Execute the following on your machine:
rclone authorize "onedrive"
Then paste the result below:
result> {"access_token":""} #復(fù)制{xx}整個(gè)內(nèi)容坟募,**包括大括號(hào){}**,后面centos掛載會(huì)用到
--------------------
[onedrive]
client_id =
client_secret =
token = {"access_token":""}
--------------------
y) Yes this is OK
e) Edit this remote
d) Delete this remote
y/e/d> y 選擇y
Current remotes:
Name Type
==== ====
onedrive onedrive
e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> q #選擇q退出
==onedrive大伙可去網(wǎng)上找相關(guān)文檔申請(qǐng)免費(fèi)5T==
到此 基本算是完成配置邑狸,可以嘗試在mac掛載
首次掛載會(huì)出錯(cuò)懈糯,因?yàn)閙ac文件系統(tǒng)原因找不到OSXFUSE
1、 Fatal error: failed to mount FUSE fs: cannot locate OSXFUSE
2单雾、 error: Directory is not empty: /data If you want to mount it anyway use: --allow-non-empty option
3赚哗、 mount helper error: mount_osxfuse: failed to mount /onedrive@/dev/osxfuse0: Operation not permitted
Fatal error: failed to mount FUSE fs: mount_osxfusefs: exit status 71
解決方案:
下載相應(yīng)的版本
1她紫、osxfuse
2、目錄可以重新創(chuàng)建一個(gè)
3屿储、目錄創(chuàng)建到當(dāng)前用戶下 mac/Users/xxxx
centos 安裝rclone
直接使用官方的一鍵安裝命令即可贿讹,輸入下面的命令:
curl https://rclone.org/install.sh | sudo bash
CentOS掛載Onedrive
接下來操作方法和mac完全一樣,就不重復(fù)了够掠,唯一的區(qū)別是“Use auto config?”這里選擇n民褂,并輸入之前獲取的token
==是否自動(dòng)配置==
Use auto config?
* Say Y if not sure
* Say N if you are working on a remote or headless machine
y) Yes
n) Noy/n> n #在這里輸入nFor this to work, you will need rclone available on a machine that has a web browser available.
輸入TOKEN
Execute the following on your machine:
rclone authorize "onedrive"Then paste the result below:result> {"access_token":""} #粘貼之前在客戶端授權(quán)的內(nèi)容,包括大括號(hào)一起粘貼進(jìn)去
掛載 OneDrive為磁盤
#新建本地文件夾疯潭,路徑自己定赊堪,即下面的LocalFolder
mkdir /home/OneDrive
#掛載為磁盤
rclone mount DriveName:Folder LocalFolder --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000
DriveName
為初始化配置填的name,Folder
為oneDrive里的文件夾,可以為/竖哩,LocalFolder為centos上的本地文件夾哭廉。
查看掛載情況
df -h
==centos需要下載fuse==
#安裝fuse
yum -y install fuse
#創(chuàng)建掛載目錄
mkdir -p /home/onedrive
#掛載
#如果需要后臺(tái)保持運(yùn)行,使用下面的命令
nohup rclone mount remote:path/to/files /home/onedrive &