mirror of
https://github.com/rclone/rclone.git
synced 2024-11-26 10:13:52 +08:00
docs: add missing code section formatting to commands and flags
This commit is contained in:
parent
9f81b4df4f
commit
53f831f40a
|
@ -29,7 +29,7 @@ var commandDefinition = &cobra.Command{
|
||||||
rclone cryptdecode returns unencrypted file names when provided with
|
rclone cryptdecode returns unencrypted file names when provided with
|
||||||
a list of encrypted file names. List limit is 10 items.
|
a list of encrypted file names. List limit is 10 items.
|
||||||
|
|
||||||
If you supply the --reverse flag, it will return encrypted file names.
|
If you supply the ` + "`--reverse`" + ` flag, it will return encrypted file names.
|
||||||
|
|
||||||
use it like this
|
use it like this
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ use it like this
|
||||||
|
|
||||||
rclone cryptdecode --reverse encryptedremote: filename1 filename2
|
rclone cryptdecode --reverse encryptedremote: filename1 filename2
|
||||||
|
|
||||||
Another way to accomplish this is by using the ` + "`rclone backend encode` (or `decode`)" + `command.
|
Another way to accomplish this is by using the ` + "`rclone backend encode` (or `decode`)" + ` command.
|
||||||
See the documentation on the [crypt](/crypt/) overlay for more info.
|
See the documentation on the [crypt](/crypt/) overlay for more info.
|
||||||
`,
|
`,
|
||||||
Run: func(command *cobra.Command, args []string) {
|
Run: func(command *cobra.Command, args []string) {
|
||||||
|
|
|
@ -37,7 +37,7 @@ Opendrive) that can have duplicate file names. It can be run on wrapping backend
|
||||||
(e.g. crypt) if they wrap a backend which supports duplicate file
|
(e.g. crypt) if they wrap a backend which supports duplicate file
|
||||||
names.
|
names.
|
||||||
|
|
||||||
However if --by-hash is passed in then dedupe will find files with
|
However if ` + "`--by-hash`" + ` is passed in then dedupe will find files with
|
||||||
duplicate hashes instead which will work on any backend which supports
|
duplicate hashes instead which will work on any backend which supports
|
||||||
at least one hash. This can be used to find files with duplicate
|
at least one hash. This can be used to find files with duplicate
|
||||||
content. This is known as deduping by hash.
|
content. This is known as deduping by hash.
|
||||||
|
|
|
@ -14,6 +14,6 @@ var completionDefinition = &cobra.Command{
|
||||||
Short: `Output completion script for a given shell.`,
|
Short: `Output completion script for a given shell.`,
|
||||||
Long: `
|
Long: `
|
||||||
Generates a shell completion script for rclone.
|
Generates a shell completion script for rclone.
|
||||||
Run with --help to list the supported shells.
|
Run with ` + "`--help`" + ` to list the supported shells.
|
||||||
`,
|
`,
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ var commandDefinition = &cobra.Command{
|
||||||
Long: `
|
Long: `
|
||||||
rclone listremotes lists all the available remotes from the config file.
|
rclone listremotes lists all the available remotes from the config file.
|
||||||
|
|
||||||
When uses with the -l flag it lists the types too.
|
When used with the ` + "`--long`" + ` flag it lists the types too.
|
||||||
`,
|
`,
|
||||||
Run: func(command *cobra.Command, args []string) {
|
Run: func(command *cobra.Command, args []string) {
|
||||||
cmd.CheckArgs(0, 0, command, args)
|
cmd.CheckArgs(0, 0, command, args)
|
||||||
|
|
|
@ -27,7 +27,7 @@ var commandDefinition = &cobra.Command{
|
||||||
Short: `List all directories/containers/buckets in the path.`,
|
Short: `List all directories/containers/buckets in the path.`,
|
||||||
Long: `
|
Long: `
|
||||||
Lists the directories in the source path to standard output. Does not
|
Lists the directories in the source path to standard output. Does not
|
||||||
recurse by default. Use the -R flag to recurse.
|
recurse by default. Use the ` + "`-R`" + ` flag to recurse.
|
||||||
|
|
||||||
This command lists the total size of the directory (if known, -1 if
|
This command lists the total size of the directory (if known, -1 if
|
||||||
not), the modification time (if known, the current time if not), the
|
not), the modification time (if known, the current time if not), the
|
||||||
|
@ -45,7 +45,7 @@ Or
|
||||||
-1 2017-01-03 14:40:54 -1 2500files
|
-1 2017-01-03 14:40:54 -1 2500files
|
||||||
-1 2017-07-08 14:39:28 -1 4000files
|
-1 2017-07-08 14:39:28 -1 4000files
|
||||||
|
|
||||||
If you just want the directory names use "rclone lsf --dirs-only".
|
If you just want the directory names use ` + "`rclone lsf --dirs-only`" + `.
|
||||||
|
|
||||||
` + lshelp.Help,
|
` + lshelp.Help,
|
||||||
Run: func(command *cobra.Command, args []string) {
|
Run: func(command *cobra.Command, args []string) {
|
||||||
|
|
|
@ -59,7 +59,7 @@ Eg
|
||||||
ferejej3gux/
|
ferejej3gux/
|
||||||
fubuwic
|
fubuwic
|
||||||
|
|
||||||
Use the --format option to control what gets listed. By default this
|
Use the ` + "`--format`" + ` option to control what gets listed. By default this
|
||||||
is just the path, but you can use these parameters to control the
|
is just the path, but you can use these parameters to control the
|
||||||
output:
|
output:
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ output:
|
||||||
T - tier of storage if known, e.g. "Hot" or "Cool"
|
T - tier of storage if known, e.g. "Hot" or "Cool"
|
||||||
|
|
||||||
So if you wanted the path, size and modification time, you would use
|
So if you wanted the path, size and modification time, you would use
|
||||||
--format "pst", or maybe --format "tsp" to put the path last.
|
` + "`--format \"pst\"`, or maybe `--format \"tsp\"`" + ` to put the path last.
|
||||||
|
|
||||||
Eg
|
Eg
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ Eg
|
||||||
2016-06-25 18:55:40;37600;fubuwic
|
2016-06-25 18:55:40;37600;fubuwic
|
||||||
|
|
||||||
If you specify "h" in the format you will get the MD5 hash by default,
|
If you specify "h" in the format you will get the MD5 hash by default,
|
||||||
use the "--hash" flag to change which hash you want. Note that this
|
use the ` + "`--hash`" + ` flag to change which hash you want. Note that this
|
||||||
can be returned as an empty string if it isn't available on the object
|
can be returned as an empty string if it isn't available on the object
|
||||||
(and for directories), "ERROR" if there was an error reading it from
|
(and for directories), "ERROR" if there was an error reading it from
|
||||||
the object and "UNSUPPORTED" if that object does not support that hash
|
the object and "UNSUPPORTED" if that object does not support that hash
|
||||||
|
@ -108,7 +108,7 @@ Eg
|
||||||
(Though "rclone md5sum ." is an easier way of typing this.)
|
(Though "rclone md5sum ." is an easier way of typing this.)
|
||||||
|
|
||||||
By default the separator is ";" this can be changed with the
|
By default the separator is ";" this can be changed with the
|
||||||
--separator flag. Note that separators aren't escaped in the path so
|
` + "`--separator`" + ` flag. Note that separators aren't escaped in the path so
|
||||||
putting it last is a good strategy.
|
putting it last is a good strategy.
|
||||||
|
|
||||||
Eg
|
Eg
|
||||||
|
@ -130,8 +130,8 @@ Eg
|
||||||
test.sh,449
|
test.sh,449
|
||||||
"this file contains a comma, in the file name.txt",6
|
"this file contains a comma, in the file name.txt",6
|
||||||
|
|
||||||
Note that the --absolute parameter is useful for making lists of files
|
Note that the ` + "`--absolute`" + ` parameter is useful for making lists of files
|
||||||
to pass to an rclone copy with the --files-from-raw flag.
|
to pass to an rclone copy with the ` + "`--files-from-raw`" + ` flag.
|
||||||
|
|
||||||
For example, to find all the files modified within one day and copy
|
For example, to find all the files modified within one day and copy
|
||||||
those only (without traversing the whole directory structure):
|
those only (without traversing the whole directory structure):
|
||||||
|
|
|
@ -61,27 +61,27 @@ The output is an array of Items, where each Item looks like this
|
||||||
"Tier" : "hot",
|
"Tier" : "hot",
|
||||||
}
|
}
|
||||||
|
|
||||||
If --hash is not specified the Hashes property won't be emitted. The
|
If ` + "`--hash`" + ` is not specified the Hashes property won't be emitted. The
|
||||||
types of hash can be specified with the --hash-type parameter (which
|
types of hash can be specified with the ` + "`--hash-type`" + ` parameter (which
|
||||||
may be repeated). If --hash-type is set then it implies --hash.
|
may be repeated). If ` + "`--hash-type`" + ` is set then it implies ` + "`--hash`" + `.
|
||||||
|
|
||||||
If --no-modtime is specified then ModTime will be blank. This can
|
If ` + "`--no-modtime`" + ` is specified then ModTime will be blank. This can
|
||||||
speed things up on remotes where reading the ModTime takes an extra
|
speed things up on remotes where reading the ModTime takes an extra
|
||||||
request (e.g. s3, swift).
|
request (e.g. s3, swift).
|
||||||
|
|
||||||
If --no-mimetype is specified then MimeType will be blank. This can
|
If ` + "`--no-mimetype`" + ` is specified then MimeType will be blank. This can
|
||||||
speed things up on remotes where reading the MimeType takes an extra
|
speed things up on remotes where reading the MimeType takes an extra
|
||||||
request (e.g. s3, swift).
|
request (e.g. s3, swift).
|
||||||
|
|
||||||
If --encrypted is not specified the Encrypted won't be emitted.
|
If ` + "`--encrypted`" + ` is not specified the Encrypted won't be emitted.
|
||||||
|
|
||||||
If --dirs-only is not specified files in addition to directories are
|
If ` + "`--dirs-only`" + ` is not specified files in addition to directories are
|
||||||
returned
|
returned
|
||||||
|
|
||||||
If --files-only is not specified directories in addition to the files
|
If ` + "`--files-only`" + ` is not specified directories in addition to the files
|
||||||
will be returned.
|
will be returned.
|
||||||
|
|
||||||
if --stat is set then a single JSON blob will be returned about the
|
if ` + "`--stat`" + ` is set then a single JSON blob will be returned about the
|
||||||
item pointed to. This will return an error if the item isn't found.
|
item pointed to. This will return an error if the item isn't found.
|
||||||
However on bucket based backends (like s3, gcs, b2, azureblob etc) if
|
However on bucket based backends (like s3, gcs, b2, azureblob etc) if
|
||||||
the item isn't found it will return an empty directory as it isn't
|
the item isn't found it will return an empty directory as it isn't
|
||||||
|
@ -90,7 +90,7 @@ possible to tell empty directories from missing directories there.
|
||||||
The Path field will only show folders below the remote path being listed.
|
The Path field will only show folders below the remote path being listed.
|
||||||
If "remote:path" contains the file "subfolder/file.txt", the Path for "file.txt"
|
If "remote:path" contains the file "subfolder/file.txt", the Path for "file.txt"
|
||||||
will be "subfolder/file.txt", not "remote:path/subfolder/file.txt".
|
will be "subfolder/file.txt", not "remote:path/subfolder/file.txt".
|
||||||
When used without --recursive the Path will always be the same as Name.
|
When used without ` + "`--recursive`" + ` the Path will always be the same as Name.
|
||||||
|
|
||||||
If the directory is a bucket in a bucket-based backend, then
|
If the directory is a bucket in a bucket-based backend, then
|
||||||
"IsBucket" will be set to true. This key won't be present unless it is
|
"IsBucket" will be set to true. This key won't be present unless it is
|
||||||
|
|
|
@ -33,7 +33,7 @@ This command can also accept a password through STDIN instead of an
|
||||||
argument by passing a hyphen as an argument. This will use the first
|
argument by passing a hyphen as an argument. This will use the first
|
||||||
line of STDIN as the password not including the trailing newline.
|
line of STDIN as the password not including the trailing newline.
|
||||||
|
|
||||||
echo "secretpassword" | rclone obscure -
|
echo "secretpassword" | rclone obscure -
|
||||||
|
|
||||||
If there is no data on STDIN to read, rclone obscure will default to
|
If there is no data on STDIN to read, rclone obscure will default to
|
||||||
obfuscating the hyphen itself.
|
obfuscating the hyphen itself.
|
||||||
|
|
20
cmd/rc/rc.go
20
cmd/rc/rc.go
|
@ -50,26 +50,26 @@ var commandDefinition = &cobra.Command{
|
||||||
Short: `Run a command against a running rclone.`,
|
Short: `Run a command against a running rclone.`,
|
||||||
Long: `
|
Long: `
|
||||||
|
|
||||||
This runs a command against a running rclone. Use the --url flag to
|
This runs a command against a running rclone. Use the ` + "`--url`" + ` flag to
|
||||||
specify an non default URL to connect on. This can be either a
|
specify an non default URL to connect on. This can be either a
|
||||||
":port" which is taken to mean "http://localhost:port" or a
|
":port" which is taken to mean "http://localhost:port" or a
|
||||||
"host:port" which is taken to mean "http://host:port"
|
"host:port" which is taken to mean "http://host:port"
|
||||||
|
|
||||||
A username and password can be passed in with --user and --pass.
|
A username and password can be passed in with ` + "`--user`" + ` and ` + "`--pass`" + `.
|
||||||
|
|
||||||
Note that --rc-addr, --rc-user, --rc-pass will be read also for --url,
|
Note that ` + "`--rc-addr`, `--rc-user`, `--rc-pass`" + ` will be read also for
|
||||||
--user, --pass.
|
` + "`--url`, `--user`, `--pass`" + `.
|
||||||
|
|
||||||
Arguments should be passed in as parameter=value.
|
Arguments should be passed in as parameter=value.
|
||||||
|
|
||||||
The result will be returned as a JSON object by default.
|
The result will be returned as a JSON object by default.
|
||||||
|
|
||||||
The --json parameter can be used to pass in a JSON blob as an input
|
The ` + "`--json`" + ` parameter can be used to pass in a JSON blob as an input
|
||||||
instead of key=value arguments. This is the only way of passing in
|
instead of key=value arguments. This is the only way of passing in
|
||||||
more complicated values.
|
more complicated values.
|
||||||
|
|
||||||
The -o/--opt option can be used to set a key "opt" with key, value
|
The ` + "`-o`/`--opt`" + ` option can be used to set a key "opt" with key, value
|
||||||
options in the form "-o key=value" or "-o key". It can be repeated as
|
options in the form ` + "`-o key=value` or `-o key`" + `. It can be repeated as
|
||||||
many times as required. This is useful for rc commands which take the
|
many times as required. This is useful for rc commands which take the
|
||||||
"opt" parameter which by convention is a dictionary of strings.
|
"opt" parameter which by convention is a dictionary of strings.
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ Will place this in the "opt" value
|
||||||
{"key":"value", "key2","")
|
{"key":"value", "key2","")
|
||||||
|
|
||||||
|
|
||||||
The -a/--arg option can be used to set strings in the "arg" value. It
|
The ` + "`-a`/`--arg`" + ` option can be used to set strings in the "arg" value. It
|
||||||
can be repeated as many times as required. This is useful for rc
|
can be repeated as many times as required. This is useful for rc
|
||||||
commands which take the "arg" parameter which by convention is a list
|
commands which take the "arg" parameter which by convention is a list
|
||||||
of strings.
|
of strings.
|
||||||
|
@ -91,13 +91,13 @@ Will place this in the "arg" value
|
||||||
|
|
||||||
["value", "value2"]
|
["value", "value2"]
|
||||||
|
|
||||||
Use --loopback to connect to the rclone instance running "rclone rc".
|
Use ` + "`--loopback`" + ` to connect to the rclone instance running ` + "`rclone rc`" + `.
|
||||||
This is very useful for testing commands without having to run an
|
This is very useful for testing commands without having to run an
|
||||||
rclone rc server, e.g.:
|
rclone rc server, e.g.:
|
||||||
|
|
||||||
rclone rc --loopback operations/about fs=/
|
rclone rc --loopback operations/about fs=/
|
||||||
|
|
||||||
Use "rclone rc" to see a list of all possible commands.`,
|
Use ` + "`rclone rc`" + ` to see a list of all possible commands.`,
|
||||||
Run: func(command *cobra.Command, args []string) {
|
Run: func(command *cobra.Command, args []string) {
|
||||||
cmd.CheckArgs(0, 1e9, command, args)
|
cmd.CheckArgs(0, 1e9, command, args)
|
||||||
cmd.Run(false, false, command, func() error {
|
cmd.Run(false, false, command, func() error {
|
||||||
|
|
|
@ -44,11 +44,11 @@ must fit into RAM. The cutoff needs to be small enough to adhere
|
||||||
the limits of your remote, please see there. Generally speaking,
|
the limits of your remote, please see there. Generally speaking,
|
||||||
setting this cutoff too high will decrease your performance.
|
setting this cutoff too high will decrease your performance.
|
||||||
|
|
||||||
Use the |--size| flag to preallocate the file in advance at the remote end
|
Use the ` + "`--size`" + ` flag to preallocate the file in advance at the remote end
|
||||||
and actually stream it, even if remote backend doesn't support streaming.
|
and actually stream it, even if remote backend doesn't support streaming.
|
||||||
|
|
||||||
|--size| should be the exact size of the input stream in bytes. If the
|
` + "`--size`" + ` should be the exact size of the input stream in bytes. If the
|
||||||
size of the stream is different in length to the |--size| passed in
|
size of the stream is different in length to the ` + "`--size`" + ` passed in
|
||||||
then the transfer will likely fail.
|
then the transfer will likely fail.
|
||||||
|
|
||||||
Note that the upload can also not be retried because the data is
|
Note that the upload can also not be retried because the data is
|
||||||
|
|
|
@ -19,7 +19,7 @@ import (
|
||||||
var Help = `
|
var Help = `
|
||||||
#### Template
|
#### Template
|
||||||
|
|
||||||
--template allows a user to specify a custom markup template for HTTP
|
` + "`--template`" + ` allows a user to specify a custom markup template for HTTP
|
||||||
and WebDAV serve functions. The server exports the following markup
|
and WebDAV serve functions. The server exports the following markup
|
||||||
to be used within the template to server pages:
|
to be used within the template to server pages:
|
||||||
|
|
||||||
|
|
|
@ -51,12 +51,12 @@ var Command = &cobra.Command{
|
||||||
This can be viewed in a web browser or you can make a remote of type
|
This can be viewed in a web browser or you can make a remote of type
|
||||||
http read from it.
|
http read from it.
|
||||||
|
|
||||||
You can use the filter flags (e.g. --include, --exclude) to control what
|
You can use the filter flags (e.g. ` + "`--include`, `--exclude`" + `) to control what
|
||||||
is served.
|
is served.
|
||||||
|
|
||||||
The server will log errors. Use -v to see access logs.
|
The server will log errors. Use ` + "`-v`" + ` to see access logs.
|
||||||
|
|
||||||
--bwlimit will be respected for file transfers. Use --stats to
|
` + "`--bwlimit`" + ` will be respected for file transfers. Use ` + "`--stats`" + ` to
|
||||||
control the stats printing.
|
control the stats printing.
|
||||||
` + httplib.Help + data.Help + auth.Help + vfs.Help,
|
` + httplib.Help + data.Help + auth.Help + vfs.Help,
|
||||||
Run: func(command *cobra.Command, args []string) {
|
Run: func(command *cobra.Command, args []string) {
|
||||||
|
|
|
@ -30,30 +30,30 @@ var ()
|
||||||
var Help = `
|
var Help = `
|
||||||
### Server options
|
### Server options
|
||||||
|
|
||||||
Use --addr to specify which IP address and port the server should
|
Use ` + "`--addr`" + ` to specify which IP address and port the server should
|
||||||
listen on, e.g. --addr 1.2.3.4:8000 or --addr :8080 to listen to all
|
listen on, e.g. ` + "`--addr 1.2.3.4:8000` or `--addr :8080`" + ` to
|
||||||
IPs. By default it only listens on localhost. You can use port
|
listen to all IPs. By default it only listens on localhost. You can use port
|
||||||
:0 to let the OS choose an available port.
|
:0 to let the OS choose an available port.
|
||||||
|
|
||||||
If you set --addr to listen on a public or LAN accessible IP address
|
If you set ` + "`--addr`" + ` to listen on a public or LAN accessible IP address
|
||||||
then using Authentication is advised - see the next section for info.
|
then using Authentication is advised - see the next section for info.
|
||||||
|
|
||||||
--server-read-timeout and --server-write-timeout can be used to
|
` + "`--server-read-timeout` and `--server-write-timeout`" + ` can be used to
|
||||||
control the timeouts on the server. Note that this is the total time
|
control the timeouts on the server. Note that this is the total time
|
||||||
for a transfer.
|
for a transfer.
|
||||||
|
|
||||||
--max-header-bytes controls the maximum number of bytes the server will
|
` + "`--max-header-bytes`" + ` controls the maximum number of bytes the server will
|
||||||
accept in the HTTP header.
|
accept in the HTTP header.
|
||||||
|
|
||||||
--baseurl controls the URL prefix that rclone serves from. By default
|
` + "`--baseurl`" + ` controls the URL prefix that rclone serves from. By default
|
||||||
rclone will serve from the root. If you used --baseurl "/rclone" then
|
rclone will serve from the root. If you used ` + "`--baseurl \"/rclone\"`" + ` then
|
||||||
rclone would serve from a URL starting with "/rclone/". This is
|
rclone would serve from a URL starting with "/rclone/". This is
|
||||||
useful if you wish to proxy rclone serve. Rclone automatically
|
useful if you wish to proxy rclone serve. Rclone automatically
|
||||||
inserts leading and trailing "/" on --baseurl, so --baseurl "rclone",
|
inserts leading and trailing "/" on ` + "`--baseurl`" + `, so ` + "`--baseurl \"rclone\"`" + `,
|
||||||
--baseurl "/rclone" and --baseurl "/rclone/" are all treated
|
` + "`--baseurl \"/rclone\"` and `--baseurl \"/rclone/\"`" + ` are all treated
|
||||||
identically.
|
identically.
|
||||||
|
|
||||||
--template allows a user to specify a custom markup template for HTTP
|
` + "`--template`" + ` allows a user to specify a custom markup template for HTTP
|
||||||
and WebDAV serve functions. The server exports the following markup
|
and WebDAV serve functions. The server exports the following markup
|
||||||
to be used within the template to server pages:
|
to be used within the template to server pages:
|
||||||
|
|
||||||
|
@ -81,9 +81,9 @@ to be used within the template to server pages:
|
||||||
By default this will serve files without needing a login.
|
By default this will serve files without needing a login.
|
||||||
|
|
||||||
You can either use an htpasswd file which can take lots of users, or
|
You can either use an htpasswd file which can take lots of users, or
|
||||||
set a single username and password with the --user and --pass flags.
|
set a single username and password with the ` + "`--user` and `--pass`" + ` flags.
|
||||||
|
|
||||||
Use --htpasswd /path/to/htpasswd to provide an htpasswd file. This is
|
Use ` + "`--htpasswd /path/to/htpasswd`" + ` to provide an htpasswd file. This is
|
||||||
in standard apache format and supports MD5, SHA1 and BCrypt for basic
|
in standard apache format and supports MD5, SHA1 and BCrypt for basic
|
||||||
authentication. Bcrypt is recommended.
|
authentication. Bcrypt is recommended.
|
||||||
|
|
||||||
|
@ -95,18 +95,18 @@ To create an htpasswd file:
|
||||||
|
|
||||||
The password file can be updated while rclone is running.
|
The password file can be updated while rclone is running.
|
||||||
|
|
||||||
Use --realm to set the authentication realm.
|
Use ` + "`--realm`" + ` to set the authentication realm.
|
||||||
|
|
||||||
#### SSL/TLS
|
#### SSL/TLS
|
||||||
|
|
||||||
By default this will serve over HTTP. If you want you can serve over
|
By default this will serve over HTTP. If you want you can serve over
|
||||||
HTTPS. You will need to supply the --cert and --key flags. If you
|
HTTPS. You will need to supply the ` + "`--cert` and `--key`" + ` flags.
|
||||||
wish to do client side certificate validation then you will need to
|
If you wish to do client side certificate validation then you will need to
|
||||||
supply --client-ca also.
|
supply ` + "`--client-ca`" + ` also.
|
||||||
|
|
||||||
--cert should be either a PEM encoded certificate or a concatenation
|
` + "`--cert`" + ` should be either a PEM encoded certificate or a concatenation
|
||||||
of that with the CA certificate. --key should be the PEM encoded
|
of that with the CA certificate. ` + "`--key`" + ` should be the PEM encoded
|
||||||
private key and --client-ca should be the PEM encoded client
|
private key and ` + "`--client-ca`" + ` should be the PEM encoded client
|
||||||
certificate authority certificate.
|
certificate authority certificate.
|
||||||
`
|
`
|
||||||
|
|
||||||
|
|
|
@ -59,8 +59,8 @@ backups.
|
||||||
|
|
||||||
The server will log errors. Use -v to see access logs.
|
The server will log errors. Use -v to see access logs.
|
||||||
|
|
||||||
--bwlimit will be respected for file transfers. Use --stats to
|
` + "`--bwlimit`" + ` will be respected for file transfers.
|
||||||
control the stats printing.
|
Use ` + "`--stats`" + ` to control the stats printing.
|
||||||
|
|
||||||
### Setting up rclone for use by restic ###
|
### Setting up rclone for use by restic ###
|
||||||
|
|
||||||
|
@ -79,11 +79,11 @@ Where you can replace "backup" in the above by whatever path in the
|
||||||
remote you wish to use.
|
remote you wish to use.
|
||||||
|
|
||||||
By default this will serve on "localhost:8080" you can change this
|
By default this will serve on "localhost:8080" you can change this
|
||||||
with use of the "--addr" flag.
|
with use of the ` + "`--addr`" + ` flag.
|
||||||
|
|
||||||
You might wish to start this server on boot.
|
You might wish to start this server on boot.
|
||||||
|
|
||||||
Adding --cache-objects=false will cause rclone to stop caching objects
|
Adding ` + "`--cache-objects=false`" + ` will cause rclone to stop caching objects
|
||||||
returned from the List call. Caching is normally desirable as it speeds
|
returned from the List call. Caching is normally desirable as it speeds
|
||||||
up downloading objects, saves transactions and uses very little memory.
|
up downloading objects, saves transactions and uses very little memory.
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ these **must** end with /. Eg
|
||||||
|
|
||||||
#### Private repositories ####
|
#### Private repositories ####
|
||||||
|
|
||||||
The "--private-repos" flag can be used to limit users to repositories starting
|
The` + "`--private-repos`" + ` flag can be used to limit users to repositories starting
|
||||||
with a path of ` + "`/<username>/`" + `.
|
with a path of ` + "`/<username>/`" + `.
|
||||||
` + httplib.Help,
|
` + httplib.Help,
|
||||||
Run: func(command *cobra.Command, args []string) {
|
Run: func(command *cobra.Command, args []string) {
|
||||||
|
|
|
@ -65,17 +65,18 @@ var Command = &cobra.Command{
|
||||||
Long: `Run a SFTP server to serve a remote over SFTP. This can be used
|
Long: `Run a SFTP server to serve a remote over SFTP. This can be used
|
||||||
with an SFTP client or you can make a remote of type sftp to use with it.
|
with an SFTP client or you can make a remote of type sftp to use with it.
|
||||||
|
|
||||||
You can use the filter flags (e.g. --include, --exclude) to control what
|
You can use the filter flags (e.g. ` + "`--include`, `--exclude`" + `) to control what
|
||||||
is served.
|
is served.
|
||||||
|
|
||||||
The server will log errors. Use -v to see access logs.
|
The server will log errors. Use ` + "`-v`" + ` to see access logs.
|
||||||
|
|
||||||
--bwlimit will be respected for file transfers. Use --stats to
|
` + "`--bwlimit`" + ` will be respected for file transfers.
|
||||||
control the stats printing.
|
Use ` + "`--stats`" + ` to control the stats printing.
|
||||||
|
|
||||||
You must provide some means of authentication, either with --user/--pass,
|
You must provide some means of authentication, either with
|
||||||
an authorized keys file (specify location with --authorized-keys - the
|
` + "`--user`/`--pass`" + `, an authorized keys file (specify location with
|
||||||
default is the same as ssh), an --auth-proxy, or set the --no-auth flag for no
|
` + "`--authorized-keys`" + ` - the default is the same as ssh), an
|
||||||
|
` + "`--auth-proxy`" + `, or set the ` + "`--no-auth`" + ` flag for no
|
||||||
authentication when logging in.
|
authentication when logging in.
|
||||||
|
|
||||||
Note that this also implements a small number of shell commands so
|
Note that this also implements a small number of shell commands so
|
||||||
|
@ -83,30 +84,30 @@ that it can provide md5sum/sha1sum/df information for the rclone sftp
|
||||||
backend. This means that is can support SHA1SUMs, MD5SUMs and the
|
backend. This means that is can support SHA1SUMs, MD5SUMs and the
|
||||||
about command when paired with the rclone sftp backend.
|
about command when paired with the rclone sftp backend.
|
||||||
|
|
||||||
If you don't supply a host --key then rclone will generate rsa, ecdsa
|
If you don't supply a host ` + "`--key`" + ` then rclone will generate rsa, ecdsa
|
||||||
and ed25519 variants, and cache them for later use in rclone's cache
|
and ed25519 variants, and cache them for later use in rclone's cache
|
||||||
directory (see "rclone help flags cache-dir") in the "serve-sftp"
|
directory (see ` + "`rclone help flags cache-dir`" + `) in the "serve-sftp"
|
||||||
directory.
|
directory.
|
||||||
|
|
||||||
By default the server binds to localhost:2022 - if you want it to be
|
By default the server binds to localhost:2022 - if you want it to be
|
||||||
reachable externally then supply "--addr :2022" for example.
|
reachable externally then supply ` + "`--addr :2022`" + ` for example.
|
||||||
|
|
||||||
Note that the default of "--vfs-cache-mode off" is fine for the rclone
|
Note that the default of ` + "`--vfs-cache-mode off`" + ` is fine for the rclone
|
||||||
sftp backend, but it may not be with other SFTP clients.
|
sftp backend, but it may not be with other SFTP clients.
|
||||||
|
|
||||||
If --stdio is specified, rclone will serve SFTP over stdio, which can
|
If ` + "`--stdio`" + ` is specified, rclone will serve SFTP over stdio, which can
|
||||||
be used with sshd via ~/.ssh/authorized_keys, for example:
|
be used with sshd via ~/.ssh/authorized_keys, for example:
|
||||||
|
|
||||||
restrict,command="rclone serve sftp --stdio ./photos" ssh-rsa ...
|
restrict,command="rclone serve sftp --stdio ./photos" ssh-rsa ...
|
||||||
|
|
||||||
On the client you need to set "--transfers 1" when using --stdio.
|
On the client you need to set ` + "`--transfers 1`" + ` when using ` + "`--stdio`" + `.
|
||||||
Otherwise multiple instances of the rclone server are started by OpenSSH
|
Otherwise multiple instances of the rclone server are started by OpenSSH
|
||||||
which can lead to "corrupted on transfer" errors. This is the case because
|
which can lead to "corrupted on transfer" errors. This is the case because
|
||||||
the client chooses indiscriminately which server to send commands to while
|
the client chooses indiscriminately which server to send commands to while
|
||||||
the servers all have different views of the state of the filing system.
|
the servers all have different views of the state of the filing system.
|
||||||
|
|
||||||
The "restrict" in authorized_keys prevents SHA1SUMs and MD5SUMs from beeing
|
The "restrict" in authorized_keys prevents SHA1SUMs and MD5SUMs from beeing
|
||||||
used. Omitting "restrict" and using --sftp-path-override to enable
|
used. Omitting "restrict" and using ` + "`--sftp-path-override`" + ` to enable
|
||||||
checksumming is possible but less secure and you could use the SFTP server
|
checksumming is possible but less secure and you could use the SFTP server
|
||||||
provided by OpenSSH in this case.
|
provided by OpenSSH in this case.
|
||||||
|
|
||||||
|
|
|
@ -14,9 +14,9 @@ var Help = `
|
||||||
By default this will serve files without needing a login.
|
By default this will serve files without needing a login.
|
||||||
|
|
||||||
You can either use an htpasswd file which can take lots of users, or
|
You can either use an htpasswd file which can take lots of users, or
|
||||||
set a single username and password with the --user and --pass flags.
|
set a single username and password with the ` + "`--user` and `--pass`" + ` flags.
|
||||||
|
|
||||||
Use --htpasswd /path/to/htpasswd to provide an htpasswd file. This is
|
Use ` + "`--htpasswd /path/to/htpasswd`" + ` to provide an htpasswd file. This is
|
||||||
in standard apache format and supports MD5, SHA1 and BCrypt for basic
|
in standard apache format and supports MD5, SHA1 and BCrypt for basic
|
||||||
authentication. Bcrypt is recommended.
|
authentication. Bcrypt is recommended.
|
||||||
|
|
||||||
|
@ -28,9 +28,9 @@ To create an htpasswd file:
|
||||||
|
|
||||||
The password file can be updated while rclone is running.
|
The password file can be updated while rclone is running.
|
||||||
|
|
||||||
Use --realm to set the authentication realm.
|
Use ` + "`--realm`" + ` to set the authentication realm.
|
||||||
|
|
||||||
Use --salt to change the password hashing salt from the default.
|
Use ` + "`--salt`" + ` to change the password hashing salt from the default.
|
||||||
`
|
`
|
||||||
|
|
||||||
// CustomAuthFn if used will be used to authenticate user, pass. If an error
|
// CustomAuthFn if used will be used to authenticate user, pass. If an error
|
||||||
|
|
|
@ -25,39 +25,39 @@ import (
|
||||||
var Help = `
|
var Help = `
|
||||||
### Server options
|
### Server options
|
||||||
|
|
||||||
Use --addr to specify which IP address and port the server should
|
Use ` + "`--addr`" + ` to specify which IP address and port the server should
|
||||||
listen on, eg --addr 1.2.3.4:8000 or --addr :8080 to listen to all
|
listen on, eg ` + "`--addr 1.2.3.4:8000` or `--addr :8080`" + ` to listen to all
|
||||||
IPs. By default it only listens on localhost. You can use port
|
IPs. By default it only listens on localhost. You can use port
|
||||||
:0 to let the OS choose an available port.
|
:0 to let the OS choose an available port.
|
||||||
|
|
||||||
If you set --addr to listen on a public or LAN accessible IP address
|
If you set ` + "`--addr`" + ` to listen on a public or LAN accessible IP address
|
||||||
then using Authentication is advised - see the next section for info.
|
then using Authentication is advised - see the next section for info.
|
||||||
|
|
||||||
--server-read-timeout and --server-write-timeout can be used to
|
` + "`--server-read-timeout` and `--server-write-timeout`" + ` can be used to
|
||||||
control the timeouts on the server. Note that this is the total time
|
control the timeouts on the server. Note that this is the total time
|
||||||
for a transfer.
|
for a transfer.
|
||||||
|
|
||||||
--max-header-bytes controls the maximum number of bytes the server will
|
` + "`--max-header-bytes`" + ` controls the maximum number of bytes the server will
|
||||||
accept in the HTTP header.
|
accept in the HTTP header.
|
||||||
|
|
||||||
--baseurl controls the URL prefix that rclone serves from. By default
|
` + "`--baseurl`" + ` controls the URL prefix that rclone serves from. By default
|
||||||
rclone will serve from the root. If you used --baseurl "/rclone" then
|
rclone will serve from the root. If you used ` + "`--baseurl \"/rclone\"`" + ` then
|
||||||
rclone would serve from a URL starting with "/rclone/". This is
|
rclone would serve from a URL starting with "/rclone/". This is
|
||||||
useful if you wish to proxy rclone serve. Rclone automatically
|
useful if you wish to proxy rclone serve. Rclone automatically
|
||||||
inserts leading and trailing "/" on --baseurl, so --baseurl "rclone",
|
inserts leading and trailing "/" on ` + "`--baseurl`" + `, so ` + "`--baseurl \"rclone\"`" + `,
|
||||||
--baseurl "/rclone" and --baseurl "/rclone/" are all treated
|
` + "`--baseurl \"/rclone\"` and `--baseurl \"/rclone/\"`" + ` are all treated
|
||||||
identically.
|
identically.
|
||||||
|
|
||||||
#### SSL/TLS
|
#### SSL/TLS
|
||||||
|
|
||||||
By default this will serve over http. If you want you can serve over
|
By default this will serve over http. If you want you can serve over
|
||||||
https. You will need to supply the --cert and --key flags. If you
|
https. You will need to supply the ` + "`--cert` and `--key`" + ` flags.
|
||||||
wish to do client side certificate validation then you will need to
|
If you wish to do client side certificate validation then you will need to
|
||||||
supply --client-ca also.
|
supply ` + "`--client-ca`" + ` also.
|
||||||
|
|
||||||
--cert should be a either a PEM encoded certificate or a concatenation
|
` + "`--cert`" + ` should be a either a PEM encoded certificate or a concatenation
|
||||||
of that with the CA certificate. --key should be the PEM encoded
|
of that with the CA certificate. ` + "`--key`" + ` should be the PEM encoded
|
||||||
private key and --client-ca should be the PEM encoded client
|
private key and ` + "`--client-ca`" + ` should be the PEM encoded client
|
||||||
certificate authority certificate.
|
certificate authority certificate.
|
||||||
`
|
`
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user