1 = The Tahoe CLI commands =
3 Tahoe provides a single executable named "tahoe", which can be used to create
4 and manage client/server nodes, manipulate the filesystem, and perform
5 several debugging/maintenance tasks.
7 This executable lives in the source tree at "bin/tahoe". Once you've done a
8 build (by running "make"), bin/tahoe can be run in-place: if it discovers
9 that it is being run from within a Tahoe source tree, it will modify sys.path
10 as necessary to use all the source code and dependent libraries contained in
13 If you've installed Tahoe (using "make install", or by installing a binary
14 package), then the tahoe executable will be available somewhere else, perhaps
15 in /usr/bin/tahoe . In this case, it will use your platform's normal
16 PYTHONPATH search paths to find the tahoe code and other libraries.
19 == CLI Command Overview ==
21 The "tahoe" tool provides access to three categories of commands.
23 * node management: create a client/server node, start/stop/restart it
24 * filesystem manipulation: list files, upload, download, delete, rename
25 * debugging: unpack cap-strings, examine share files
27 To get a list of all commands, just run "tahoe" with no additional arguments.
28 "tahoe --help" might also provide something useful.
30 Running "tahoe --version" will display a list of version strings, starting
31 with the "allmydata" module (which contains the majority of the Tahoe
32 functionality) and including versions for a number of dependent libraries,
33 like Twisted, Foolscap, pycryptopp, and zfec.
38 "tahoe create-node [NODEDIR]" is the basic make-a-new-node command. It
39 creates a new directory and populates it with files that will allow the
40 "tahoe start" command to use it later on. This command creates nodes that
41 have client functionality (upload/download files), web API services
42 (controlled by the 'webport' file), and storage services (unless
43 "--no_storage" is specified).
45 NODEDIR defaults to ~/.tahoe/ , and newly-created nodes default to
46 publishing a web server on port 3456 (limited to the loopback interface, at
47 127.0.0.1, to restrict access to other programs on the same host). All of the
48 other "tahoe" subcommands use corresponding defaults.
50 "tahoe create-client [NODEDIR]" creates a node with no storage service.
51 That is, it behaves like "tahoe create-node --no-storage [NODEDIR]".
52 (This is a change from versions prior to 1.6.0.)
54 "tahoe create-introducer [NODEDIR]" is used to create the Introducer node.
55 This node provides introduction services and nothing else. When started, this
56 node will produce an introducer.furl, which should be published to all
59 "tahoe create-key-generator [NODEDIR]" is used to create a special
60 "key-generation" service, which allows a client to offload their RSA key
61 generation to a separate process. Since RSA key generation takes several
62 seconds, and must be done each time a directory is created, moving it to a
63 separate process allows the first process (perhaps a busy wapi server) to
64 continue servicing other requests. The key generator exports a FURL that can
65 be copied into a node to enable this functionality.
67 "tahoe run [NODEDIR]" will start a previously-created node in the foreground.
69 "tahoe start [NODEDIR]" will launch a previously-created node. It will launch
70 the node into the background, using the standard Twisted "twistd"
71 daemon-launching tool. On some platforms (including Windows) this command is
72 unable to run a daemon in the background; in that case it behaves in the
73 same way as "tahoe run".
75 "tahoe stop [NODEDIR]" will shut down a running node.
77 "tahoe restart [NODEDIR]" will stop and then restart a running node. This is
78 most often used by developers who have just modified the code and want to
79 start using their changes.
82 == Virtual Drive Manipulation ==
84 These commands let you exmaine a Tahoe filesystem, providing basic
85 list/upload/download/delete/rename/mkdir functionality. They can be used as
86 primitives by other scripts. Most of these commands are fairly thin wrappers
89 By default, all filesystem-manipulation commands look in ~/.tahoe/ to figure
90 out which Tahoe node they should use. When the CLI command uses wapi calls,
91 it will use ~/.tahoe/node.url for this purpose: a running Tahoe node that
92 provides a wapi port will write its URL into this file. If you want to use
93 a node on some other host, just create ~/.tahoe/ and copy that node's wapi
94 URL into this file, and the CLI commands will contact that node instead of a
97 These commands also use a table of "aliases" to figure out which directory
98 they ought to use a starting point. This is explained in more detail below.
100 In Tahoe up to v1.6.0, passing non-ASCII characters to the CLI is not guaranteed
101 to work, although it might work on your platform, especially if your platform
104 === Starting Directories ===
106 As described in architecture.txt, the Tahoe distributed filesystem consists
107 of a collection of directories and files, each of which has a "read-cap" or a
108 "write-cap" (also known as a URI). Each directory is simply a table that maps
109 a name to a child file or directory, and this table is turned into a string
110 and stored in a mutable file. The whole set of directory and file "nodes" are
111 connected together into a directed graph.
113 To use this collection of files and directories, you need to choose a
114 starting point: some specific directory that we will refer to as a
115 "starting directory". For a given starting directory, the "ls
116 [STARTING_DIR]:" command would list the contents of this directory,
117 the "ls [STARTING_DIR]:dir1" command would look inside this directory
118 for a child named "dir1" and list its contents, "ls
119 [STARTING_DIR]:dir1/subdir2" would look two levels deep, etc.
121 Note that there is no real global "root" directory, but instead each
122 starting directory provides a different, possibly overlapping
123 perspective on the graph of files and directories.
125 Each tahoe node remembers a list of starting points, named "aliases",
126 in a file named ~/.tahoe/private/aliases . These aliases are short
127 strings that stand in for a directory read- or write- cap. If you use
128 the command line "ls" without any "[STARTING_DIR]:" argument, then it
129 will use the default alias, which is "tahoe", therefore "tahoe ls" has
130 the same effect as "tahoe ls tahoe:". The same goes for the other
131 commands which can reasonably use a default alias: get, put, mkdir,
134 For backwards compatibility with Tahoe-1.0, if the "tahoe": alias is not
135 found in ~/.tahoe/private/aliases, the CLI will use the contents of
136 ~/.tahoe/private/root_dir.cap instead. Tahoe-1.0 had only a single starting
137 point, and stored it in this root_dir.cap file, so Tahoe-1.1 will use it if
138 necessary. However, once you've set a "tahoe:" alias with "tahoe set-alias",
139 that will override anything in the old root_dir.cap file.
141 The Tahoe CLI commands use the same filename syntax as scp and rsync
142 -- an optional "alias:" prefix, followed by the pathname or filename.
143 Some commands (like "tahoe cp") use the lack of an alias to mean that
144 you want to refer to a local file, instead of something from the tahoe
145 virtual filesystem. [TODO] Another way to indicate this is to start
146 the pathname with a dot, slash, or tilde.
148 When you're dealing a single starting directory, the "tahoe:" alias is
149 all you need. But when you want to refer to something that isn't yet
150 attached to the graph rooted at that starting directory, you need to
151 refer to it by its capability. The way to do that is either to use its
152 capability directory as an argument on the command line, or to add an
153 alias to it, with the "tahoe add-alias" command. Once you've added an
154 alias, you can use that alias as an argument to commands.
156 The best way to get started with Tahoe is to create a node, start it, then
157 use the following command to create a new directory and set it as your
160 tahoe add-alias tahoe `tahoe mkdir`
162 After that you can use "tahoe ls tahoe:" and "tahoe cp local.txt tahoe:",
163 and both will refer to the directory that you've just created.
165 ==== SECURITY NOTE: For users of shared systems ====
167 Remember that command-line arguments are visible to other users (through the
168 'ps' command, or the Windows Process Explorer tool), so if you are using a
169 tahoe node on a shared host, your login neighbors will be able to see (and
170 capture) any directory caps that you set up with the "tahoe add-alias"
171 command. To avoid this, bypass add-alias and edit the NODEDIR/private/aliases
172 file directly, by adding a line like this:
174 fun: URI:DIR2:ovjy4yhylqlfoqg2vcze36dhde:4d4f47qko2xm5g7osgo2yyidi5m4muyo2vjjy53q4vjju2u55mfa
176 By entering the dircap through the editor, the command-line arguments are
177 bypassed, and other users will not be able to see them. Once you've added the
178 alias, no other secrets are passed through the command line, so this
179 vulnerability becomes less significant: they can still see your filenames and
180 other arguments you type there, but not the caps that Tahoe uses to permit
181 access to your files and directories.
183 The new "tahoe create-alias" command creates a new directory and puts the cap
184 into your aliases file for you, thus avoiding this problem.
187 === Command Syntax Summary ===
189 tahoe add-alias alias cap
192 tahoe mkdir [alias:]path
193 tahoe ls [alias:][path]
194 tahoe webopen [alias:][path]
195 tahoe put [--mutable] [localfrom:-]
196 tahoe put [--mutable] [localfrom:-] [alias:]to
197 tahoe put [--mutable] [localfrom:-] [alias:]subdir/to
198 tahoe put [--mutable] [localfrom:-] dircap:to
199 tahoe put [--mutable] [localfrom:-] dircap:./subdir/to
200 tahoe put [localfrom:-] mutable-file-writecap
201 tahoe get [alias:]from [localto:-]
202 tahoe cp [-r] [alias:]frompath [alias:]topath
203 tahoe rm [alias:]what
204 tahoe mv [alias:]from [alias:]to
205 tahoe ln [alias:]from [alias:]to
206 tahoe backup localfrom [alias:]to
208 === Command Examples ===
212 This creates a new empty unlinked directory, and prints its write-cap to
213 stdout. The new directory is not attached to anything else.
215 tahoe add-alias fun DIRCAP
219 tahoe add-alias fun URI:DIR2:ovjy4yhylqlfoqg2vcze36dhde:4d4f47qko2xm5g7osgo2yyidi5m4muyo2vjjy53q4vjju2u55mfa
221 This creates an alias "fun:" and configures it to use the given directory
222 cap. Once this is done, "tahoe ls fun:" will list the contents of this
223 directory. Use "tahoe add-alias tahoe DIRCAP" to set the contents of the
224 default "tahoe:" alias.
226 tahoe create-alias fun
228 This combines 'tahoe mkdir' and 'tahoe add-alias' into a single step.
232 This displays a table of all configured aliases.
237 This both create a new empty directory and attaches it to your root with the
245 All four list the root directory of your personal virtual filesystem.
249 This lists a subdirectory of your filesystem.
253 tahoe webopen tahoe:subdir/
254 tahoe webopen subdir/
256 This uses the python 'webbrowser' module to cause a local web browser to
257 open to the web page for the given directory. This page offers interfaces to
258 add, dowlonad, rename, and delete files in the directory. If not given an
259 alias or path, opens "tahoe:", the root dir of the default alias.
263 tahoe put /tmp/file.txt
266 These upload the local file into the grid, and prints the new read-cap to
267 stdout. The uploaded file is not attached to any directory. All one-argument
268 forms of "tahoe put" perform an unlinked upload.
273 These also perform an unlinked upload, but the data to be uploaded is taken
276 tahoe put file.txt uploaded.txt
277 tahoe put file.txt tahoe:uploaded.txt
279 These upload the local file and add it to your root with the name
282 tahoe put file.txt subdir/foo.txt
283 tahoe put - subdir/foo.txt
284 tahoe put file.txt tahoe:subdir/foo.txt
285 tahoe put file.txt DIRCAP:./foo.txt
286 tahoe put file.txt DIRCAP:./subdir/foo.txt
288 These upload the named file and attach them to a subdirectory of the given
289 root directory, under the name "foo.txt". Note that to use a directory
290 write-cap instead of an alias, you must use ":./" as a separator, rather
291 than ":", to help the CLI parser figure out where the dircap ends. When the
292 source file is named "-", the contents are taken from stdin.
294 tahoe put file.txt --mutable
296 Create a new mutable file, fill it with the contents of file.txt, and print
297 the new write-cap to stdout.
299 tahoe put file.txt MUTABLE-FILE-WRITECAP
301 Replace the contents of the given mutable file with the contents of file.txt
302 and prints the same write-cap to stdout.
304 tahoe cp file.txt tahoe:uploaded.txt
305 tahoe cp file.txt tahoe:
306 tahoe cp file.txt tahoe:/
307 tahoe cp ./file.txt tahoe:
309 These upload the local file and add it to your root with the name
312 tahoe cp tahoe:uploaded.txt downloaded.txt
313 tahoe cp tahoe:uploaded.txt ./downloaded.txt
314 tahoe cp tahoe:uploaded.txt /tmp/downloaded.txt
315 tahoe cp tahoe:uploaded.txt ~/downloaded.txt
317 This downloads the named file from your tahoe root, and puts the result on
318 your local filesystem.
320 tahoe cp tahoe:uploaded.txt fun:stuff.txt
322 This copies a file from your tahoe root to a different virtual directory,
323 set up earlier with "tahoe add-alias fun DIRCAP".
325 tahoe rm uploaded.txt
326 tahoe rm tahoe:uploaded.txt
328 This deletes a file from your tahoe root.
330 tahoe mv uploaded.txt renamed.txt
331 tahoe mv tahoe:uploaded.txt tahoe:renamed.txt
333 These rename a file within your tahoe root directory.
335 tahoe mv uploaded.txt fun:
336 tahoe mv tahoe:uploaded.txt fun:
337 tahoe mv tahoe:uploaded.txt fun:uploaded.txt
339 These move a file from your tahoe root directory to the virtual directory
340 set up earlier with "tahoe add-alias fun DIRCAP"
342 tahoe backup ~ work:backups
344 This command performs a full versioned backup of every file and directory
345 underneath your "~" home directory, placing an immutable timestamped
346 snapshot in e.g. work:backups/Archives/2009-02-06_04:00:05Z/ (note that the
347 timestamp is in UTC, hence the "Z" suffix), and a link to the latest
348 snapshot in work:backups/Latest/ . This command uses a small SQLite database
349 known as the "backupdb", stored in ~/.tahoe/private/backupdb.sqlite, to
350 remember which local files have been backed up already, and will avoid
351 uploading files that have already been backed up. It compares timestamps and
352 filesizes when making this comparison. It also re-uses existing directories
353 which have identical contents. This lets it run faster and reduces the
354 number of directories created.
356 If you reconfigure your client node to switch to a different grid, you
357 should delete the stale backupdb.sqlite file, to force "tahoe backup" to
358 upload all files to the new grid.
360 tahoe backup --exclude=*~ ~ work:backups
362 Same as above, but this time the backup process will ignore any
363 filename that will end with '~'. '--exclude' will accept any standard
364 unix shell-style wildcards, have a look at
365 http://docs.python.org/library/fnmatch.html for a more detailed
366 reference. You may give multiple '--exclude' options. Please pay
367 attention that the pattern will be matched against any level of the
368 directory tree, it's still impossible to specify absolute path exclusions.
370 tahoe backup --exclude-from=/path/to/filename ~ work:backups
372 '--exclude-from' is similar to '--exclude', but reads exclusion
373 patterns from '/path/to/filename', one per line.
375 tahoe backup --exclude-vcs ~ work:backups
377 This command will ignore any known file or directory that's used by
378 version control systems to store metadata. The list of the exluded
400 == Virtual Drive Maintenance ==
402 tahoe manifest tahoe:
403 tahoe manifest --storage-index tahoe:
404 tahoe manifest --verify-cap tahoe:
405 tahoe manifest --repair-cap tahoe:
406 tahoe manifest --raw tahoe:
408 This performs a recursive walk of the given directory, visiting every file
409 and directory that can be reached from that point. It then emits one line to
410 stdout for each object it encounters.
412 The default behavior is to print the access cap string (like URI:CHK:.. or
413 URI:DIR2:..), followed by a space, followed by the full path name.
415 If --storage-index is added, each line will instead contain the object's
416 storage index. This (string) value is useful to determine which share files
417 (on the server) are associated with this directory tree. The --verify-cap
418 and --repair-cap options are similar, but emit a verify-cap and repair-cap,
419 respectively. If --raw is provided instead, the output will be a
420 JSON-encoded dictionary that includes keys for pathnames, storage index
421 strings, and cap strings. The last line of the --raw output will be a JSON
422 encoded deep-stats dictionary.
426 This performs a recursive walk of the given directory, visiting every file
427 and directory that can be reached from that point. It gathers statistics on
428 the sizes of the objects it encounters, and prints a summary to stdout.
433 For a list of all debugging commands, use "tahoe debug".
435 "tahoe debug find-shares STORAGEINDEX NODEDIRS.." will look through one or
436 more storage nodes for the share files that are providing storage for the
439 "tahoe debug catalog-shares NODEDIRS.." will look through one or more storage
440 nodes and locate every single share they contain. It produces a report on
441 stdout with one line per share, describing what kind of share it is, the
442 storage index, the size of the file is used for, etc. It may be useful to
443 concatenate these reports from all storage hosts and use it to look for
446 "tahoe debug dump-share SHAREFILE" will take the name of a single share file
447 (as found by "tahoe find-shares") and print a summary of its contents to
448 stdout. This includes a list of leases, summaries of the hash tree, and
449 information from the UEB (URI Extension Block). For mutable file shares, it
450 will describe which version (seqnum and root-hash) is being stored in this
453 "tahoe debug dump-cap CAP" will take a URI (a file read-cap, or a directory
454 read- or write- cap) and unpack it into separate pieces. The most useful
455 aspect of this command is to reveal the storage index for any given URI. This
456 can be used to locate the share files that are holding the encoded+encrypted
459 "tahoe debug repl" will launch an interactive python interpreter in which the
460 Tahoe packages and modules are available on sys.path (e.g. by using 'import
461 allmydata'). This is most useful from a source tree: it simply sets the
462 PYTHONPATH correctly and runs the 'python' executable.
464 "tahoe debug corrupt-share SHAREFILE" will flip a bit in the given sharefile.
465 This can be used to test the client-side verification/repair code. Obviously
466 this command should not be used during normal operation.