本篇內(nèi)容介紹了“Debian怎么使用rclone掛載硬盤”的有關(guān)知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領(lǐng)大家學習一下如何處理這些情況吧!希望大家仔細閱讀,能夠?qū)W有所成!
公司主營業(yè)務(wù):成都網(wǎng)站設(shè)計、網(wǎng)站制作、移動網(wǎng)站開發(fā)等業(yè)務(wù)。幫助企業(yè)客戶真正實現(xiàn)互聯(lián)網(wǎng)宣傳,提高企業(yè)的競爭能力。創(chuàng)新互聯(lián)是一支青春激揚、勤奮敬業(yè)、活力青春激揚、勤奮敬業(yè)、活力澎湃、和諧高效的團隊。公司秉承以“開放、自由、嚴謹、自律”為核心的企業(yè)文化,感謝他們對我們的高要求,感謝他們從不同領(lǐng)域給我們帶來的挑戰(zhàn),讓我們激情的團隊有機會用頭腦與智慧不斷的給客戶帶來驚喜。創(chuàng)新互聯(lián)推出烏當免費做網(wǎng)站回饋大家。
#安裝rclone
nano rclone.sh
輸入下列內(nèi)容,并保存
#!/bin/bash apt-get install -y nload htop fuse p7zip-full KernelBit="$(getconf LONG_BIT)" [[ "$KernelBit" == '32' ]] && KernelBitVer='i386' [[ "$KernelBit" == '64' ]] && KernelBitVer='amd64' [[ -z "$KernelBitVer" ]] && exit 1 cd /tmp wget -O '/tmp/rclone.zip' "https://downloads.rclone.org/rclone-current-linux-$KernelBitVer.zip" 7z x /tmp/rclone.zip cd rclone-* cp -raf rclone /usr/bin/ chown root:root /usr/bin/rclone chmod 755 /usr/bin/rclone mkdir -p /usr/local/share/man/man1 cp -raf rclone.1 /usr/local/share/man/man1/ mandb
執(zhí)行
bash rclone_debian
#初始化配置
rclone config
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n
name> gdrive #隨便填,后面要用到
Type of storage to configure.
Choose a number from below, or type in your own value
1 / Amazon Drive
"amazon cloud drive"
2 / Amazon S3 (also Dreamhost, Ceph, Minio)
"s3"
3 / Backblaze B2
"b2"
4 / Box
"box"
5 / Cache a remote
"cache"
6 / Dropbox
"dropbox"
7 / Encrypt/Decrypt a remote
"crypt"
8 / FTP Connection
"ftp"
9 / Google Cloud Storage (this is not Google Drive)
"google cloud storage"
10 / Google Drive
"drive"
11 / Hubic
"hubic"
12 / Local Disk
"local"
13 / Microsoft Azure Blob Storage
"azureblob"
14 / Microsoft OneDrive
"onedrive"
15 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
"swift"
16 / Pcloud
"pcloud"
17 / QingCloud Object Storage
"qingstor"
18 / SSH/SFTP Connection
"sftp"
19 / Webdav
"webdav"
20 / Yandex Disk
"yandex"
21 / http Connection
"http"
Storage> 10 #選擇10,Google Drive
Google Application Client Id - leave blank normally.
client_id> #留空
Google Application Client Secret - leave blank normally.
client_secret> #留空
Service Account Credentials JSON file path - needed only if you want use SA instead of interactive login.
service_account_file>
Remote config
Use auto config?
* Say Y if not sure
* Say N if you are working on a remote or headless machine or Y didn't work
y) Yes
n) No
y/n> n #選擇n
If your browser doesn't open automatically go to the following link: https://accounts.google.com/o/oauth2/auth.... #復制到瀏覽器打開,獲取驗證碼
Log in and authorize rclone for access
Enter verification code> #填入上面獲取到的驗證碼
Configure this as a team drive?
y) Yes
n) No
y/n> y #選擇y
Fetching team drive list...
No team drives found in your account--------------------
[dengxj]
client_id =
client_secret =
service_account_file =
token = {"access_token":"ya29.GltFBd7UJN2qrxdG8FnG_rMuB18ogb8QlujdL7glvXtfV"}
team_drive =
--------------------
y) Yes this is OK
e) Edit this remote
d) Delete this remote
y/e/d> y #選擇y
Current remotes:
Name Type
==== ====
dengxj drive
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退出
掛載為磁盤
#新建本地文件夾,路徑自己定,即下面的LocalFolder
mkdir /root/GoogleDrive
#掛載為磁盤
格式:
rclone mount DriveName:Folder LocalFolder --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000
我們這里可以這樣填
rclone mount gdrive: /root/GoogleDrive --allow-other --allow-non-empty --vfs-cache-mode writes
如需卸載磁盤
fusermount -qzu LocalFolder
三、自啟動
(1)下載并編輯腳本
nano rcloned
輸入下面內(nèi)容
#!/bin/bash PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin export PATH NAME_BIN="rclone" ### BEGIN INIT INFO # Provides: rclone # Required-Start: $all # Required-Stop: $all # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start rclone at boot time # Description: Enable rclone by daemon. ### END INIT INFO NAME="" #rclone name名 REMOTE='' #遠程文件夾 LOCAL='' #掛載地址 Green_font_prefix="[32m" && Red_font_prefix="[31m" && Green_background_prefix="[42;37m" && Red_background_prefix="[41;37m" && Font_color_suffix="[0m" Info="${Green_font_prefix}[信息]${Font_color_suffix}" Error="${Red_font_prefix}[錯誤]${Font_color_suffix}" RETVAL=0 check_running(){ PID="$(ps -C $NAME_BIN -o pid= |head -n1 |grep -o '[0-9]{1,}')" if [[ ! -z ${PID} ]]; then return 0 else return 1 fi } do_start(){ check_running if [[ $? -eq 0 ]]; then echo -e "${Info} $NAME_BIN (PID ${PID}) 正在運行..." && exit 0 else fusermount -zuq $LOCAL >/dev/null 2>&1 mkdir -p $LOCAL sudo /usr/bin/rclone mount $NAME:$REMOTE $LOCAL --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000 >/dev/null 2>&1 & sleep 2s check_running if [[ $? -eq 0 ]]; then echo -e "${Info} $NAME_BIN 啟動成功 !" else echo -e "${Error} $NAME_BIN 啟動失敗 !" fi fi } do_stop(){ check_running if [[ $? -eq 0 ]]; then kill -9 ${PID} RETVAL=$? if [[ $RETVAL -eq 0 ]]; then echo -e "${Info} $NAME_BIN 停止成功 !" else echo -e "${Error} $NAME_BIN 停止失敗 !" fi else echo -e "${Info} $NAME_BIN 未運行" RETVAL=1 fi fusermount -zuq $LOCAL >/dev/null 2>&1 } do_status(){ check_running if [[ $? -eq 0 ]]; then echo -e "${Info} $NAME_BIN (PID $(echo ${PID})) 正在運行..." else echo -e "${Info} $NAME_BIN 未運行 !" RETVAL=1 fi } do_restart(){ do_stop do_start } case "$1" in start|stop|restart|status) do_$1 ;; *) echo "使用方法: $0 { start | stop | restart | status }" RETVAL=1 ;; esac exit $RETVAL
修改其中的
NAME="" #rclone name名,及配置時輸入的Name
REMOTE=’’ #遠程文件夾,Google Drive網(wǎng)盤里的掛載的一個文件夾
LOCAL=’’ #掛載地址,vps本地掛載目錄
然后
#Debian系統(tǒng)
apt-get install sudo -y
#設(shè)置自啟
mv rcloned /etc/init.d/rcloned chmod +x /etc/init.d/rcloned update-rc.d -f rcloned defaults bash /etc/init.d/rcloned start
“Debian怎么使用rclone掛載硬盤”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識可以關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實用文章!
新聞標題:Debian怎么使用rclone掛載硬盤
URL地址:http://muchs.cn/article6/gcioig.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站收錄、手機網(wǎng)站建設(shè)、電子商務(wù)、網(wǎng)站設(shè)計公司、網(wǎng)頁設(shè)計公司、網(wǎng)站導航
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)