
Rclone is a single-binary command-line tool that copies, syncs, encrypts and mounts files across cloud storage. It is written in Go, open source (MIT), and works with over 70 storage products: S3 and S3-compatible stores, Google Drive, Dropbox, OneDrive, Backblaze B2, SFTP, WebDAV, FTP and more. If you have ever wished rsync could talk to your bucket or your Drive, this is it.
flowchart LR
L[Local disk] <--> R([rclone])
S3[S3, R2, B2] <--> R
GD[Drive, Dropbox, OneDrive] <--> R
SF[SFTP, WebDAV, FTP] <--> R
R --> X[mount, serve, crypt]Install
# Linux / macOS / BSD (official script)
sudo -v ; curl https://rclone.org/install.sh | sudo bash
# Windows
winget install Rclone.Rclone
rclone versionbrew install rclone also works, but the Homebrew build does not support rclone mount on macOS. Use the official binary if you need mounting. To upgrade later, run rclone selfupdate, or use your package manager if that is how you installed it.
Configure a remote
Run rclone config, choose n (new remote), give it a name such as gdrive, pick the storage type and follow the prompts. OAuth-based services (Drive, Dropbox, OneDrive) open a browser; on a headless server, run rclone authorize on a machine that has one and paste the token back.
rclone listremotes # list configured remotes
rclone lsd gdrive: # list top-level directories
rclone about gdrive: # quota and usage (if the backend supports it)
rclone ncdu gdrive: # interactive disk-usage browserRemotes are addressed as name:path. Run rclone config file to see where the config lives. It stores credentials, so treat it like a secret (rclone can encrypt it with a config password).
The commands that matter
Command | What it does |
|---|---|
| Copies new or changed files from source to destination. Never deletes anything at the destination. |
| Makes the destination identical to the source, deleting extra files at the destination. |
| Copies, then deletes the source files. |
| Compares source and destination (hashes or sizes) without changing anything. |
| Two-way sync. Still documented as beta and an advanced command, so read the docs first. |
rclone copy ~/Photos gdrive:Photos -P
rclone sync ~/Documents s3:my-bucket/docs -P --dry-run
rclone check ~/Documents s3:my-bucket/docs
rclone copy s3:my-bucket/docs ~/restore -P # restore: swap source and destination-P shows live progress. Useful tuning flags: --transfers (parallel file transfers, default 4), --bwlimit 5M (cap bandwidth), --exclude "*.tmp" and --filter-from rules.txt. Unlike rsync, trailing slashes make no difference.
How rclone decides what to copy
By default, rclone treats a file as unchanged when its size and modification time match. You can change that:
--checksumcompares hashes instead of modification times. It is more reliable but slower, and only works when both sides support a common hash.--size-onlycompares size alone.--ignore-timesskips the check and transfers everything.
Sync safely
sync is the command that bites. Build these habits:
Preview first with
--dry-run(-n).Mind the order. It is always
SOURCE DEST. Swap them and you can delete the wrong side.Keep a safety net with
--backup-dir s3:my-bucket/archive, which moves deleted or overwritten files there instead of discarding them. It must be on the same remote as the destination and must not overlap the synced path.Set a limit with
--max-delete 100so a mistake cannot wipe thousands of files.Log it with
--log-file rclone.log -v.
Mount a remote as a folder
# Linux / macOS
rclone mount gdrive: ~/gdrive --vfs-cache-mode full --daemon
fusermount -u ~/gdrive # unmount on Linux (fusermount3 -u on newer distros, umount on macOS)Linux needs FUSE, and Windows needs WinFsp. On macOS you need macFUSE or FUSE-T, or you can use rclone nfsmount, which avoids FUSE entirely. --vfs-cache-mode full makes applications that read and write files randomly behave properly. A mount is convenient, but it is still a network drive, so expect latency. For heavy work, copy the files locally first.
Serve a remote
Rclone can also expose any remote over HTTP, WebDAV, FTP, SFTP or S3, which is handy for sharing a bucket or a Drive folder with tools that expect one of those protocols.
rclone serve webdav gdrive:Photos --addr 127.0.0.1:8080 --user me --pass secretBinding to 127.0.0.1 keeps it local. If you expose it to a network, always set credentials.
Encrypt with crypt
Rclone's crypt backend wraps another remote and encrypts file contents (and, optionally, file and directory names) before upload.
Run
rclone configand create a new remote of typecrypt.Point it at an existing path, for example
s3:my-bucket/encrypted.Set a password (and a salt, if prompted).
rclone sync ~/Documents secret: -PBack up the passwords. Without them, the data is unrecoverable.
Automate it
0 2 * * * rclone sync /home/me/Documents s3:my-bucket/docs --log-file /var/log/rclone.log -vRun rclone check now and then to confirm the backup matches the source, and try a test restore into an empty folder. A backup you never verify is a hope, not a backup.
Gotchas
Google Drive rate limits: create your own OAuth client ID instead of using rclone's shared one.
Keep it updated: recent releases (v1.74.3 and v1.75.0) fixed a number of security issues, including ones in the
rcserver and theservecommands. If you exposerclone rcdorrclone serve, bind to localhost or require authentication.Bisync is beta: do not use it as your only copy of important data.
Wrap-up
Install it, configure one remote, and run copy with -P. Add --dry-run before every sync, and you have a safe, scriptable way to move data between almost any storage you use.
Comments(0)
Join the discussion by logging into your account.
No comments yet. Be the first to comment!