"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1387],{2314:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>a,contentTitle:()=>c,default:()=>h,frontMatter:()=>o,metadata:()=>t,toc:()=>d});vari=r(5893),s=r(1151);consto={},c="The Drives CLI",t={id:"guides/drives/cli",title:"The Drives CLI",description:"The zrok drives CLI tools allow for simple, ergonomic management and synchronization of local and remote files.",source:"@site/../docs/guides/drives/cli.md",sourceDirName:"guides/drives",slug:"/guides/drives/cli",permalink:"/docs/guides/drives/cli",draft:!1,unlisted:!1,editUrl:"https://github.com/openziti/zrok/blob/main/docs/../docs/guides/drives/cli.md",tags:[],version:"current",frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Instance Config",permalink:"/docs/guides/self-hosting/instance-configuration"},next:{title:"VPN",permalink:"/docs/guides/vpn/"}},a={},d=[{value:"Sharing a Drive",id:"sharing-a-drive",level:2},{value:"Working with a Private Drive Share",id:"working-with-a-private-drive-share",level:2},{value:"Working with Public Shares",id:"working-with-public-shares",level:2},{value:"One-way Synchronization",id:"one-way-synchronization",level:2},{value:"Drive-to-Drive Copies and Synchronization",id:"drive-to-drive-copies-and-synchronization",level:2},{value:"Copying from Drives to the Local Filesystem",id:"copying-from-drives-to-the-local-filesystem",level:2},{value:"Unique Names and Reserved Shares",id:"unique-names-and-reserved-shares",level:2},{value:"Future Enhancements",id:"future-enhancements",level:2}];functionl(e){constn={code:"code",em:"em",h1:"h1",h2:"h2",li:"li",p:"p",pre:"pre",ul:"ul",...(0,s.a)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.h1,{id:"the-drives-cli",children:"The Drives CLI"}),"\n",(0,i.jsx)(n.p,{children:"The zrok drives CLI tools allow for simple, ergonomic management and synchronization of local and remote files."}),"\n",(0,i.jsx)(n.h2,{id:"sharing-a-drive",children:"Sharing a Drive"}),"\n",(0,i.jsxs)(n.p,{children:["Virtual drives are shared through the ",(0,i.jsx)(n.code,{children:"zrok"})," CLI using the ",(0,i.jsx)(n.code,{children:"--backend-mode drive"})," flag through the ",(0,i.jsx)(n.code,{children:"zrok share"})," command, using either the ",(0,i.jsx)(n.code,{children:"public"})," or ",(0,i.jsx)(n.code,{children:"private"})," sharing modes. We'll use the ",(0,i.jsx)(n.code,{children:"private"})," sharing mode for this example:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{children:"$ mkdir /tmp/junk\n$ zrok share private --headless --backend-mode drive /tmp/junk\n[ 0.124] INFO sdk-golang/ziti.(*listenerManager).createSessionWithBackoff: {session token=[cf640aac-2706-49ae-9cc9-9a497d67d9c5]} new service session\n[ 0.145] INFO main.(*sharePrivateCommand).run: allow other to access your share with the following command:\nzrok access private wkcfb58vj51l\n"})}),"\n",(0,i.jsxs)(n.p,{children:["The command shown above creates an ephemeral, ",(0,i.jsx)(n.code,{children:"private"})," drive share pointed at the local ",(0,i.jsx)(n.code,{children:"/tmp/junk"})," folder."]}),"\n",(0,i.jsxs)(n.p,{children:["Notice that the share token allocated by ",(0,i.jsx)(n.code,{children:"zrok"})," is ",(0,i.jsx)(n.code,{children:"wkcfb58vj51l"}),". We'll use that share token to identify our virtual drive in the following operations."]}),"\n",(0,i.jsx)(n.h2,{id:"working-with-a-private-drive-share",children:"Working with a Private Drive Share"}),"\n",(0,i.jsxs)(n.p,{children:["First, let's copy a file into our virtual drive using the ",(0,i.jsx)(n.code,{children:"zrok copy"})," command:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{children:"$ zrok copy LICENSE zrok://wkcfb58vj51l\n[ 0.119] INFO zrok/drives/sync.OneWay: => /LICENSE\ncopy complete!\n"})}),"\n",(0,i.jsxs)(n.p,{children:["We used the URL scheme ",(0,i.jsx)(n.code,{children:"zrok://<shareToken>"})," to refer to the private virtual drive we allocated above using the ",(0,i.jsx)(n.code,{children:"zrok share private"})," command. Use ",(0,i.jsx)(n.code,{children: