{"id":481,"date":"2019-04-05T07:18:56","date_gmt":"2019-04-04T23:18:56","guid":{"rendered":"http:\/\/www.xxhjkl.me\/?p=481"},"modified":"2020-03-17T09:00:24","modified_gmt":"2020-03-17T01:00:24","slug":"debian%e4%bd%bf%e7%94%a8-rclone-%e6%8c%82%e8%bd%bd-onedrive%e7%bd%91%e7%9b%98","status":"publish","type":"post","link":"https:\/\/www.xxhjkl.me\/?p=481","title":{"rendered":"debian\u4f7f\u7528 Rclone \u6302\u8f7d OneDrive\u7f51\u76d8"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\" id=\"%E5%89%8D%E8%A8%80\">\u524d\u8a00<\/h1>\n\n\n\n<p>\u4ece\u903c\u738b\u90a3\u91cc\u641e\u4e86\u4e2aE3\u8ba2\u9605\u7684\u5b50\u8d26\u53f7\uff0c\u6709\u4e2a5T\u7684onedrive\u53ef\u4ee5\u7528\uff0c\u6b63\u597d\u624b\u5934\u6709\u95f2\u7f6e\u670d\u52a1\u5668\u548cPT\u7ad9\uff0c\u6240\u4ee5\u5c31\u840c\u751f\u4e86\u4ecePT\u62d6\u9ad8\u6e05\u8d44\u6e90\u4e0b\u6765\u586b\u5230\u8fd95T\u91cc\u9762\u3002\u53ef\u4ee5\u62ff\u6765\u5728\u7ebf\u770b\uff0c\u5c82\u4e0d\u662f\u7f8e\u6ecb\u6ecb\u3002\u8bf4\u5e72\u5c31\u5e72\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"%E8%8E%B7%E5%8F%96+token\">\u83b7\u53d6 token<\/h2>\n\n\n\n<p>\u5728\u672c\u5730 Windows \u7535\u8111\u4e0a\u4e0b\u8f7d rclone\uff0c\u70b9<a rel=\"noreferrer noopener\" aria-label=\"\u8fd9\u91cc\uff08\u5728\u65b0\u7a97\u53e3\u6253\u5f00\uff09\" href=\"https:\/\/rclone.org\/downloads\/\" target=\"_blank\">\u8fd9\u91cc<\/a>\u4e0b\u8f7d\uff0c\u7136\u540e\u89e3\u538b\u51fa\u6765\uff0c\u6bd4\u5982\u6211\u628a\u5b83\u89e3\u538b\u5230C\u76d8\u6839\u76ee\u5f55\u4e0b\u7684rclone\u6587\u4ef6\u5939\u5185\uff0c\u90a3\u4e48\u540e\u7eed\u64cd\u4f5c\u5c31\u662f\uff0c\u6253\u5f00Windows powershell\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n\n\n\n<p>cd C:\\rclone<\/p>\n\n\n\n<p>.\\rclone.exe authorize &#8220;onedrive&#8221;<\/p>\n\n\n\n<p>\u4f1a\u6253\u5f00\u4e00\u4e2a\u7f51\u9875\uff0c\u5728\u7f51\u9875\u4e0a\u767b\u5f55\u4f60\u7684\u8d26\u53f7\uff0c\u56de\u5230 Windows powershell\uff0c\u4f1a\u51fa\u6765\u4f60\u6240\u9700\u8981\u7684token\u3002\u5982\u4e0b\u56fe<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/hk.img.xxhjkl.me\/images\/2019\/04\/28\/93dbe2caly1g1rdnnpo6yj20nt0comyd.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<p>{&#8220;access_token&#8221;:&#8221;xxxxxxxx&#8221;}  # \u6ce8\u610f!\u590d\u5236{xxxxxxxx}\u6574\u4e2a\u82b1\u62ec\u53f7\u5185\u5bb9\uff0c\u5e76\u4fdd\u5b58\u597d\uff0c\u540e\u9762\u9700\u8981\u7528\u5230\u3002<\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"%E5%AE%89%E8%A3%85+Rclone\">\u5b89\u88c5 Rclone<\/h1>\n\n\n\n<p>\u5b98\u65b9\u63d0\u4f9b\u4e86\u4e00\u952e\u5b89\u88c5\u811a\u672c\uff0c\u670d\u52a1\u5668\u4e0a\u6267\u884c\uff1a<\/p>\n\n\n\n<p>curl https:\/\/rclone.org\/install.sh | bash<\/p>\n\n\n\n<p>\u5b89\u88c5\u5b8c\u6bd5\u4ee5\u540e\u7ee7\u7eed<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"%E9%85%8D%E7%BD%AE+Rclone\">\u914d\u7f6e Rclone<\/h2>\n\n\n\n<p>\u6267\u884c\uff1a<\/p>\n\n\n\n<p> rclone config <\/p>\n\n\n\n<p>\u4f1a\u51fa\u6765\u4e00\u7cfb\u5217\u914d\u7f6e\u8fc7\u7a0b\uff0c\u7f51\u4e0a\u7684\u5f88\u591a\u6559\u7a0b\u5df2\u7ecf\u6bd4\u8f83\u65e7\u4e86\uff0c\u6211\u628a\u6628\u665a\u914d\u7f6e\u7684\u8fc7\u7a0b\u8d34\u4e00\u4e0b\u3002\u5927\u540c\u5c0f\u5f02\u3002<\/p>\n\n\n\n<p>n) New remote<br>s) Set configuration password<br>q) Quit config<br>n\/s\/q&gt; n   \u8fd9\u91cc\u9009n\u5c31\u662f\u65b0\u5efa\u7684\u610f\u601d<br>name&gt; E3   # \u8f93\u5165\u540d\u79f0\uff0c\u6211\u8fd9\u91cc\u6302\u8f7d\u7684\u662fE3\u8ba2\u9605\u7684\uff0c\u6240\u4ee5\u53d6\u540d\u53ebE3\uff0c\u4f60\u4eec\u90a3\u8fb9\u968f\u610f\u3002<br> Type of storage to configure.<br> Enter a string value. Press Enter for the default (&#8220;&#8221;).<br> Choose a number from below, or type in your own value<br>  1 \/ A stackable unification remote, which can appear to merge the contents of several remotes<br>    \\ &#8220;union&#8221;<br>  2 \/ Alias for a existing remote<br>    \\ &#8220;alias&#8221;<br>  3 \/ Amazon Drive<br>    \\ &#8220;amazon cloud drive&#8221;<br>  4 \/ Amazon S3 Compliant Storage Providers (AWS, Ceph, Dreamhost, IBM COS, Minio)<br>    \\ &#8220;s3&#8221;<br>  5 \/ Backblaze B2<br>    \\ &#8220;b2&#8221;<br>  6 \/ Box<br>    \\ &#8220;box&#8221;<br>  7 \/ Cache a remote<br>    \\ &#8220;cache&#8221;<br>  8 \/ Dropbox<br>    \\ &#8220;dropbox&#8221;<br>  9 \/ Encrypt\/Decrypt a remote<br>    \\ &#8220;crypt&#8221;<br> 10 \/ FTP Connection<br>    \\ &#8220;ftp&#8221;<br> 11 \/ Google Cloud Storage (this is not Google Drive)<br>    \\ &#8220;google cloud storage&#8221;<br> 12 \/ Google Drive<br>    \\ &#8220;drive&#8221;<br> 13 \/ Hubic<br>    \\ &#8220;hubic&#8221;<br> 14 \/ JottaCloud<br>    \\ &#8220;jottacloud&#8221;<br> 15 \/ Local Disk<br>    \\ &#8220;local&#8221;<br> 16 \/ Mega<br>    \\ &#8220;mega&#8221;<br> 17 \/ Microsoft Azure Blob Storage<br>    \\ &#8220;azureblob&#8221;<br> 18 \/ Microsoft OneDrive<br>    \\ &#8220;onedrive&#8221;<br> 19 \/ OpenDrive<br>    \\ &#8220;opendrive&#8221;<br> 20 \/ Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)<br>    \\ &#8220;swift&#8221;<br> 21 \/ Pcloud<br>    \\ &#8220;pcloud&#8221;<br> 22 \/ QingCloud Object Storage<br>    \\ &#8220;qingstor&#8221;<br> 23 \/ SSH\/SFTP Connection<br>    \\ &#8220;sftp&#8221;<br> 24 \/ Webdav<br>    \\ &#8220;webdav&#8221;<br> 25 \/ Yandex Disk<br>    \\ &#8220;yandex&#8221;<br> 26 \/ http Connection<br>    \\ &#8220;http&#8221;<br> Storage&gt; 18  # \u9009\u62e918\uff0cMicrosoft OneDrive<br> ** See help for onedrive backend at: https:\/\/rclone.org\/onedrive\/ **<br> <br> Microsoft App Client Id<br> Leave blank normally.<br> Enter a string value. Press Enter for the default (&#8220;&#8221;).<br> client_id&gt;   # \u7559\u7a7a\uff0c\u56de\u8f66<br> Microsoft App Client Secret<br> Leave blank normally.<br> Enter a string value. Press Enter for the default (&#8220;&#8221;).<br> client_secret&gt;   # \u7559\u7a7a\uff0c\u56de\u8f66<br> Edit advanced config? (y\/n)<br> y) Yes<br> n) No<br> y\/n&gt; n  # \u9009n<br> Remote config<br> Use auto config?<br> Say Y if not sure<br> Say N if you are working on a remote or headless machine<br> y) Yes<br> n) No<br> y\/n&gt; n  # \u9009n<br> For this to work, you will need rclone available on a machine that has a web browser available.<br> Execute the following on your machine:<br> rclone authorize &#8220;onedrive&#8221;<br> Then paste the result below:<br> result&gt; {&#8220;XXXXXXXX&#8221;}  # \u4e0a\u9762\u4fdd\u5b58\u7684token\u590d\u5236\u5230\u8fd9\u91cc<br> 2018\/10\/31 19:54:06 ERROR : Failed to save new token in config file: section &#8216;E3&#8217; not found<br> Choose a number from below, or type in an existing value <br>  1 \/ OneDrive Personal or Business<br>    \\ &#8220;onedrive&#8221;<br>  2 \/ Root Sharepoint site<br>    \\ &#8220;sharepoint&#8221;<br>  3 \/ Type in driveID<br>    \\ &#8220;driveid&#8221;<br>  4 \/ Type in SiteID<br>    \\ &#8220;siteid&#8221;<br>  5 \/ Search a Sharepoint site<br>    \\ &#8220;search&#8221;<br> Your choice&gt; 1  # \u8fd9\u91cc\u95ee\u4f60\u8981\u9009\u62e9\u7684\u7c7b\u578b\uff0c\u90091<br> Found 1 drives, please select the one you want to use:<br> 0: OneDrive (business) <br> Chose drive to use:&gt; 0  # \u7a0b\u5e8f\u627e\u5230\u7f51\u76d8\uff0c\u8fd9\u91cc\u7f16\u53f7\u662f0\uff0c\u5c31\u9009\u62e90<br> Found drive &#8216;root&#8217; of type &#8216;business&#8217;, URL: https:\/\/xxxxxx-my.sharepoint.com\/personal\/xxxxxxx\/Documents<br> Is that okay?<br> y) Yes<br> n) No<br> y\/n&gt; y  # \u9009y<br> [E3]<br> type = onedrive<br> token = {&#8220;XXXXXXXX&#8221;}<br> drive_id = XXXXXXXXX<br> drive_type = business<br> y) Yes this is OK<br> e) Edit this remote<br> d) Delete this remote<br> y\/e\/d&gt; y  # \u9009y<br> Current remotes:<br> Name                 Type<br> ====                 ====<br>  E3               onedrive<br> e) Edit existing remote<br> n) New remote<br> d) Delete remote<br> r) Rename remote<br> c) Copy remote<br> s) Set configuration password<br> q) Quit config<br> e\/n\/d\/r\/c\/s\/q&gt; q  # \u9009q\uff0c\u9000\u51fa<br><\/p>\n\n\n\n<p>\u8fd9\u6837\u5c31\u662f Rclone \u5c31\u5df2\u7ecf\u6210\u529f\u8fde\u63a5\u5230 OneDrive\u4e86\u3002<\/p>\n\n\n\n<p class=\"has-large-font-size\"> \u5b89\u88c5 fuse<\/p>\n\n\n\n<p>debian\u7cfb\u7edf\uff1a<br><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt-get update &amp;&amp; apt-get install -y fuse <\/code><\/pre>\n\n\n\n<p>centos\u7cfb\u7edf\uff1a<br><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>yum install -y fuse<\/code><\/pre>\n\n\n\n<p>\u6302\u8f7d\uff1a<\/p>\n\n\n\n<p>#\u6302\u8f7d<\/p>\n\n\n\n<p>rclone mount &lt;\u7f51\u76d8\u540d\u79f0:\u7f51\u76d8\u8def\u5f84&gt; &lt;\u672c\u5730\u8def\u5f84&gt; [\u53c2\u6570] &#8211;daemon<\/p>\n\n\n\n<p>#\u53d6\u6d88\u6302\u8f7d<\/p>\n\n\n\n<p>fusermount -qzu &lt;\u672c\u5730\u8def\u5f84&gt; <\/p>\n\n\n\n<p>\u7f51\u76d8\u540d\u79f0 \u4e3a\u914d\u7f6e\u65f6\u586b\u7684name\uff0c\u7f51\u76d8\u8def\u5f84 \u4e3a\u7f51\u76d8\u91cc\u7684\u6587\u4ef6\u5939\uff0c\u7559\u7a7a\u4e3a\u6574\u4e2a\u7f51\u76d8\uff0c\u672c\u5730\u8def\u5f84 \u4e3a\u670d\u52a1\u5668\u4e0a\u7684\u672c\u5730\u6587\u4ef6\u5939\u3002\u53c2\u6570\u53ef\u4ee5\u67e5\u770b\u5b98\u65b9\u6587\u6863\u6839\u636e\u9700\u6c42\u8fdb\u884c\u9009\u62e9\u3002\u5b9e\u9645\u8f93\u5165\u65f6\u4e0d\u8981\u6709\u62ec\u53f7\uff0c\u8fd9\u91cc\u53ea\u662f\u4e3a\u4e86\u66f4\u6e05\u695a\u7684\u533a\u5206\u3002&#8211;daemon \u4e3a\u8fdb\u7a0b\u5b88\u62a4\u53c2\u6570\uff0c\u53ef\u540e\u53f0\u8fd0\u884c\u3002\u4f8b\u5982\u6211\u7684\u6302\u8f7d\u547d\u4ee4\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>rclone mount E3:\/ \/root\/oneDrive --copy-links --allow-other --allow-non-empty --umask 000 --daemon<\/code><\/pre>\n\n\n\n<p>E3:\/\u8fd9\u4e2a\u5c31\u662f\u4e4b\u524d\u914d\u7f6e\u7684\u65f6\u5019\u7684name\uff0c:\/\u5c31\u662f\u8bf4\u6574\u4e2a\u7f51\u76d8\u6302\u8f7d\u8fc7\u6765\uff0c\u4f60\u4e5f\u53ef\u4ee5\u5177\u4f53\u6302\u8f7d\u7f51\u76d8\u91cc\u9762\u7684\u67d0\u4e2a\u76ee\u5f55\uff0c\u6bd4\u5982\u53ef\u4ee5\u5199 E3:PT\uff0c\u8fd9\u6837\u5c31\u662f\u628aonedrive\u91cc\u9762\u7684PT\u8fd9\u4e2a\u6587\u4ef6\u5939\u6302\u8f7d\u8fc7\u6765\u3002<br>\/root\/oneDrive\u8fd9\u5c31\u662f\u672c\u5730\u7684\u6587\u4ef6\u5939\u3002\u9700\u8981\u81ea\u5df1\u5148\u5efa\u7acb\u597d\u76ee\u5f55\u3002<br><\/p>\n\n\n\n<p>\u7136\u540e \u7528df -h\u547d\u4ee4\u770b\u4e00\u4e0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/hk.img.xxhjkl.me\/images\/2019\/04\/28\/93dbe2caly1g1re7xb19ij20ch083jra.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u770b\u5230\u6700\u540e\u4e00\u884cE3 5.0T\u5c31\u662f\u6302\u8f7d\u4e0a\u4e86\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"%E8%AE%BE%E7%BD%AE%E4%B8%BA%E8%87%AA%E5%90%AF%E5%8A%A8\">\u8bbe\u7f6e\u4e3a\u81ea\u542f\u52a8<\/h2>\n\n\n\n<p>\u4e0b\u8f7d\u811a\u672c<\/p>\n\n\n\n<p>wget -N https:\/\/raw.githubusercontent.com\/P3TERX\/script\/master\/rcloned &amp;&amp; nano rcloned<\/p>\n\n\n\n<p>\u4fee\u6539\u914d\u7f6e\u6587\u4ef6<\/p>\n\n\n\n<p>NAME=&#8221;Onedrive&#8221; #Rclone\u914d\u7f6e\u65f6\u586b\u5199\u7684name<br>REMOTE=&#8221;  #\u8fdc\u7a0b\u6587\u4ef6\u5939\uff0c\u7f51\u76d8\u91cc\u7684\u6302\u8f7d\u7684\u4e00\u4e2a\u6587\u4ef6\u5939\uff0c\u7559\u7a7a\u4e3a\u6574\u4e2a\u7f51\u76d8<br>LOCAL=&#8217;\/Onedrive&#8217;  #\u6302\u8f7d\u5730\u5740\uff0cVPS\u672c\u5730\u6302\u8f7d\u76ee\u5f55<\/p>\n\n\n\n<p>\u8bbe\u7f6e\u5f00\u673a\u542f\u52a8<\/p>\n\n\n\n<p>mv rcloned \/etc\/init.d\/rcloned<br>chmod +x \/etc\/init.d\/rcloned<br>update-rc.d -f rcloned defaults<br>bash \/etc\/init.d\/rcloned start<\/p>\n\n\n\n<p>\u770b\u5230 rclone \u542f\u52a8\u6210\u529f ! \u5373\u53ef\u3002<\/p>\n\n\n\n<p>\u7ba1\u7406<br>\n\u5f00\u59cb\u6302\u8f7d bash \/etc\/init.d\/rcloned start<\/p>\n\n\n\n<p>\u505c\u6b62\u6302\u8f7d bash \/etc\/init.d\/rcloned stop<\/p>\n\n\n\n<p>\u91cd\u65b0\u6302\u8f7d bash \/etc\/init.d\/rcloned restart<\/p>\n\n\n\n<p>\u67e5\u770b\u65e5\u5fd7 tail -f \/$HOME\/.rclone\/rcloned.log<\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"mce_73\">\u540c\u6b65\u6587\u4ef6<\/h1>\n\n\n\n<p>rclone copy\u547d\u4ee4\u53ef\u4ee5\u5f80\u7f51\u76d8\u91cc\u4f20\u6587\u4ef6\u3002<\/p>\n\n\n\n<p> rclone copy \u672c\u5730\u6587\u4ef6 \u8fdc\u7a0b\u6587\u4ef6\u5939\uff0c\u4f8b\u5982\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>rclone copy 1.mp4 E3:PT\/test -v<\/code><\/pre>\n\n\n\n<p>\u8fd9\u6837\u5c31\u662f\u628a\u672c\u5730\u76841.mp4\u540c\u6b65\u5230onedrive\u91cc\u9762\u7684\/PT\/test\u8fd9\u4e2a\u6587\u4ef6\u5939\u91cc\u9762\uff0c\u8fdc\u7a0b\u6ca1\u6709\u6587\u4ef6\u5939\u4f1a\u81ea\u52a8\u521b\u5efa\u7684\u3002-v\u4f1a\u663e\u793a\u901f\u5ea6\u3002\u5176\u4ed6\u5c31\u81ea\u5df1\u767e\u5ea6\u5427<\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"%E5%8F%82%E8%80%83\">\u53c2\u8003<\/h1>\n\n\n\n<p><a href=\"https:\/\/p3terx.com\/archives\/linux-vps-uses-rclone-to-mount-network-drives-such-as-onedrive-and-google-drive.html\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"Linux VPS \u4f7f\u7528 Rclone \u6302\u8f7d OneDrive\u3001Google Drive \u7b49\u7f51\u76d8\uff08\u5728\u65b0\u7a97\u53e3\u6253\u5f00\uff09\">Linux VPS \u4f7f\u7528 Rclone \u6302\u8f7d OneDrive\u3001Google Drive \u7b49\u7f51\u76d8<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u8a00 \u4ece\u903c\u738b\u90a3\u91cc\u641e\u4e86\u4e2aE3\u8ba2\u9605\u7684\u5b50\u8d26\u53f7\uff0c\u6709\u4e2a5T\u7684onedrive\u53ef\u4ee5\u7528\uff0c\u6b63\u597d\u624b\u5934\u6709\u95f2\u7f6e\u670d\u52a1\u5668\u548cPT\u7ad9\uff0c\u6240\u4ee5\u5c31\u840c\u751f\u4e86\u4ecePT\u62d6\u9ad8\u6e05\u8d44\u6e90\u4e0b\u6765\u586b\u5230\u8fd95T\u91cc\u9762\u3002\u53ef\u4ee5\u62ff\u6765\u5728\u7ebf\u770b\uff0c\u5c82\u4e0d\u662f\u7f8e\u6ecb\u6ecb\u3002\u8bf4\u5e72\u5c31\u5e72\u3002 \u83b7\u53d6 token \u5728\u672c\u5730 Windows \u7535\u8111 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.xxhjkl.me\/index.php?rest_route=\/wp\/v2\/posts\/481"}],"collection":[{"href":"https:\/\/www.xxhjkl.me\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xxhjkl.me\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xxhjkl.me\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xxhjkl.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=481"}],"version-history":[{"count":10,"href":"https:\/\/www.xxhjkl.me\/index.php?rest_route=\/wp\/v2\/posts\/481\/revisions"}],"predecessor-version":[{"id":569,"href":"https:\/\/www.xxhjkl.me\/index.php?rest_route=\/wp\/v2\/posts\/481\/revisions\/569"}],"wp:attachment":[{"href":"https:\/\/www.xxhjkl.me\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=481"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xxhjkl.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=481"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xxhjkl.me\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=481"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}