rclone掛載onedrive

在Mac/Centos上使用rclone掛載OneDrive網(wǎng)盤

1.png

關(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

2.png

==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 &

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末期丰,一起剝皮案震驚了整個(gè)濱河市群叶,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌钝荡,老刑警劉巖街立,帶你破解...
    沈念sama閱讀 218,546評(píng)論 6 507
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場(chǎng)離奇詭異埠通,居然都是意外死亡赎离,警方通過查閱死者的電腦和手機(jī),發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,224評(píng)論 3 395
  • 文/潘曉璐 我一進(jìn)店門端辱,熙熙樓的掌柜王于貴愁眉苦臉地迎上來梁剔,“玉大人,你說我怎么就攤上這事舞蔽∪俨。” “怎么了?”我有些...
    開封第一講書人閱讀 164,911評(píng)論 0 354
  • 文/不壞的土叔 我叫張陵渗柿,是天一觀的道長(zhǎng)个盆。 經(jīng)常有香客問我,道長(zhǎng)朵栖,這世上最難降的妖魔是什么颊亮? 我笑而不...
    開封第一講書人閱讀 58,737評(píng)論 1 294
  • 正文 為了忘掉前任,我火速辦了婚禮陨溅,結(jié)果婚禮上终惑,老公的妹妹穿的比我還像新娘。我一直安慰自己门扇,他們只是感情好雹有,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,753評(píng)論 6 392
  • 文/花漫 我一把揭開白布偿渡。 她就那樣靜靜地躺著,像睡著了一般件舵。 火紅的嫁衣襯著肌膚如雪卸察。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 51,598評(píng)論 1 305
  • 那天铅祸,我揣著相機(jī)與錄音,去河邊找鬼合武。 笑死临梗,一個(gè)胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的稼跳。 我是一名探鬼主播盟庞,決...
    沈念sama閱讀 40,338評(píng)論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼,長(zhǎng)吁一口氣:“原來是場(chǎng)噩夢(mèng)啊……” “哼汤善!你這毒婦竟也來了什猖?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 39,249評(píng)論 0 276
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤红淡,失蹤者是張志新(化名)和其女友劉穎不狮,沒想到半個(gè)月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體在旱,經(jīng)...
    沈念sama閱讀 45,696評(píng)論 1 314
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡摇零,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,888評(píng)論 3 336
  • 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了桶蝎。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片驻仅。...
    茶點(diǎn)故事閱讀 40,013評(píng)論 1 348
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡,死狀恐怖登渣,靈堂內(nèi)的尸體忽然破棺而出噪服,到底是詐尸還是另有隱情,我是刑警寧澤胜茧,帶...
    沈念sama閱讀 35,731評(píng)論 5 346
  • 正文 年R本政府宣布粘优,位于F島的核電站,受9級(jí)特大地震影響竹揍,放射性物質(zhì)發(fā)生泄漏敬飒。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,348評(píng)論 3 330
  • 文/蒙蒙 一芬位、第九天 我趴在偏房一處隱蔽的房頂上張望无拗。 院中可真熱鬧,春花似錦昧碉、人聲如沸英染。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,929評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)四康。三九已至搪搏,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間闪金,已是汗流浹背疯溺。 一陣腳步聲響...
    開封第一講書人閱讀 33,048評(píng)論 1 270
  • 我被黑心中介騙來泰國(guó)打工, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留哎垦,地道東北人囱嫩。 一個(gè)月前我還...
    沈念sama閱讀 48,203評(píng)論 3 370
  • 正文 我出身青樓,卻偏偏與公主長(zhǎng)得像漏设,于是被迫代替她去往敵國(guó)和親墨闲。 傳聞我的和親對(duì)象是個(gè)殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,960評(píng)論 2 355

推薦閱讀更多精彩內(nèi)容