github.com/ncw/rclone@v1.48.1-0.20190724201158-a35aa1360e3e/docs/content/commands/rclone_serve_restic.md (about) 1 --- 2 date: 2019-06-20T16:09:42+01:00 3 title: "rclone serve restic" 4 slug: rclone_serve_restic 5 url: /commands/rclone_serve_restic/ 6 --- 7 ## rclone serve restic 8 9 Serve the remote for restic's REST API. 10 11 ### Synopsis 12 13 rclone serve restic implements restic's REST backend API 14 over HTTP. This allows restic to use rclone as a data storage 15 mechanism for cloud providers that restic does not support directly. 16 17 [Restic](https://restic.net/) is a command line program for doing 18 backups. 19 20 The server will log errors. Use -v to see access logs. 21 22 --bwlimit will be respected for file transfers. Use --stats to 23 control the stats printing. 24 25 ### Setting up rclone for use by restic ### 26 27 First [set up a remote for your chosen cloud provider](/docs/#configure). 28 29 Once you have set up the remote, check it is working with, for example 30 "rclone lsd remote:". You may have called the remote something other 31 than "remote:" - just substitute whatever you called it in the 32 following instructions. 33 34 Now start the rclone restic server 35 36 rclone serve restic -v remote:backup 37 38 Where you can replace "backup" in the above by whatever path in the 39 remote you wish to use. 40 41 By default this will serve on "localhost:8080" you can change this 42 with use of the "--addr" flag. 43 44 You might wish to start this server on boot. 45 46 ### Setting up restic to use rclone ### 47 48 Now you can [follow the restic 49 instructions](http://restic.readthedocs.io/en/latest/030_preparing_a_new_repo.html#rest-server) 50 on setting up restic. 51 52 Note that you will need restic 0.8.2 or later to interoperate with 53 rclone. 54 55 For the example above you will want to use "http://localhost:8080/" as 56 the URL for the REST server. 57 58 For example: 59 60 $ export RESTIC_REPOSITORY=rest:http://localhost:8080/ 61 $ export RESTIC_PASSWORD=yourpassword 62 $ restic init 63 created restic backend 8b1a4b56ae at rest:http://localhost:8080/ 64 65 Please note that knowledge of your password is required to access 66 the repository. Losing your password means that your data is 67 irrecoverably lost. 68 $ restic backup /path/to/files/to/backup 69 scan [/path/to/files/to/backup] 70 scanned 189 directories, 312 files in 0:00 71 [0:00] 100.00% 38.128 MiB / 38.128 MiB 501 / 501 items 0 errors ETA 0:00 72 duration: 0:00 73 snapshot 45c8fdd8 saved 74 75 #### Multiple repositories #### 76 77 Note that you can use the endpoint to host multiple repositories. Do 78 this by adding a directory name or path after the URL. Note that 79 these **must** end with /. Eg 80 81 $ export RESTIC_REPOSITORY=rest:http://localhost:8080/user1repo/ 82 # backup user1 stuff 83 $ export RESTIC_REPOSITORY=rest:http://localhost:8080/user2repo/ 84 # backup user2 stuff 85 86 #### Private repositories #### 87 88 The "--private-repos" flag can be used to limit users to repositories starting 89 with a path of "/<username>/". 90 91 ### Server options 92 93 Use --addr to specify which IP address and port the server should 94 listen on, eg --addr 1.2.3.4:8000 or --addr :8080 to listen to all 95 IPs. By default it only listens on localhost. You can use port 96 :0 to let the OS choose an available port. 97 98 If you set --addr to listen on a public or LAN accessible IP address 99 then using Authentication is advised - see the next section for info. 100 101 --server-read-timeout and --server-write-timeout can be used to 102 control the timeouts on the server. Note that this is the total time 103 for a transfer. 104 105 --max-header-bytes controls the maximum number of bytes the server will 106 accept in the HTTP header. 107 108 #### Authentication 109 110 By default this will serve files without needing a login. 111 112 You can either use an htpasswd file which can take lots of users, or 113 set a single username and password with the --user and --pass flags. 114 115 Use --htpasswd /path/to/htpasswd to provide an htpasswd file. This is 116 in standard apache format and supports MD5, SHA1 and BCrypt for basic 117 authentication. Bcrypt is recommended. 118 119 To create an htpasswd file: 120 121 touch htpasswd 122 htpasswd -B htpasswd user 123 htpasswd -B htpasswd anotherUser 124 125 The password file can be updated while rclone is running. 126 127 Use --realm to set the authentication realm. 128 129 #### SSL/TLS 130 131 By default this will serve over http. If you want you can serve over 132 https. You will need to supply the --cert and --key flags. If you 133 wish to do client side certificate validation then you will need to 134 supply --client-ca also. 135 136 --cert should be a either a PEM encoded certificate or a concatenation 137 of that with the CA certificate. --key should be the PEM encoded 138 private key and --client-ca should be the PEM encoded client 139 certificate authority certificate. 140 141 142 ``` 143 rclone serve restic remote:path [flags] 144 ``` 145 146 ### Options 147 148 ``` 149 --addr string IPaddress:Port or :Port to bind server to. (default "localhost:8080") 150 --append-only disallow deletion of repository data 151 --cert string SSL PEM key (concatenation of certificate and CA certificate) 152 --client-ca string Client certificate authority to verify clients with 153 -h, --help help for restic 154 --htpasswd string htpasswd file - if not provided no authentication is done 155 --key string SSL PEM Private key 156 --max-header-bytes int Maximum size of request header (default 4096) 157 --pass string Password for authentication. 158 --private-repos users can only access their private repo 159 --realm string realm for authentication (default "rclone") 160 --server-read-timeout duration Timeout for server reading data (default 1h0m0s) 161 --server-write-timeout duration Timeout for server writing data (default 1h0m0s) 162 --stdio run an HTTP2 server on stdin/stdout 163 --user string User name for authentication. 164 ``` 165 166 See the [global flags page](/flags/) for global options not listed here. 167 168 ### SEE ALSO 169 170 * [rclone serve](/commands/rclone_serve/) - Serve a remote over a protocol. 171