Storage: buckets and file servers
Browse, download, upload and share files in S3-compatible buckets, Google Cloud Storage, Azure Blob Storage, on WebDAV, FTPS, SFTP and FTP servers, and on Windows (SMB) shares, all with the same commands.
Add a bucket
komando storage add backups 's3://AKIAEXAMPLE@my-bucket/db?region=eu-west-1' --ask-password
komando test backups # can komando reach it and log in?
Typed alone, komando storage add asks for each part step by step.
For S3, the user part of the URL is the access key ID. The secret access key goes in the vault, like a password: --ask-password asks for it (hidden), or store it first and point at it:
komando secret set backups-secret
komando storage add backups 's3://AKIAEXAMPLE@my-bucket/db?region=eu-west-1' --password-ref secret:backups-secret
The safest setup is an access key that can only do what komando needs (read-only for reports, one bucket only). The service then enforces it.
The folder in the URL is where the conn starts. Keys are relative to it and cannot leave it (../ is refused, also in a dry run).
At a terminal, a command with the storage or the file left out asks for it, with a list of your storages. Typed alone, komando storage list asks which storage. An AI agent or a script gets USAGE (exit 2) with a full example in the hint.
| Kind | URL example | Notes |
|---|---|---|
| S3 and compatible | s3://ACCESS_KEY_ID@my-bucket/backups?endpoint=https://minio.internal:9000®ion=us-east-1 | AWS S3, MinIO, Cloudflare R2, Wasabi, DigitalOcean Spaces, Backblaze B2, Garage. Leave out endpoint for AWS. If the endpoint's DNS is wrong or missing, add &resolve=IP (or IP:PORT): komando connects to that address and still checks the certificate against the endpoint's name. |
| Google Cloud Storage | gs://my-bucket/backups | Logs in like gcloud (application default credentials), or with a service account key in --password-ref. See Google Cloud and Azure. |
| Azure Blob Storage | azblob://ACCOUNT@my-container/backups | The storage account's key, or a SAS token, in --password-ref. |
| WebDAV | webdavs://alice@cloud.example.com/remote.php/dav/files/alice | Nextcloud, ownCloud, a NAS, Apache or nginx. Add ?tls=skip-verify only for a self-signed certificate you trust. webdav:// (no encryption) is refused without ?insecure=1. |
| FTPS | ftps://deploy@files.example.com/public_html | FTP with TLS. Add ?tls=skip-verify only for a self-signed certificate you trust. |
| SFTP | sftp://deploy@files.example.com/uploads | File access over SSH, for accounts without a shell. The path starts at the server's root (on hosting, often your home folder). |
| SMB (Windows shares) | smb://alice@fileserver.corp.lan/team/reports?domain=CORP | A Windows file server, Samba, a NAS or Azure Files. The first part of the path is the share. See Windows shares. |
| FTP | ftp://deploy@files.example.com/www?insecure=1 | No encryption: the password and files travel in clear. Refused without ?insecure=1. Prefer FTPS or SFTP. |
A certificate from your own CA (a company MinIO, or a proxy that inspects TLS): store the CA and name it in the URL, for S3, Google Cloud and Azure. komando then trusts that CA as well as the usual ones, and still checks the certificate fully. Without it, the error is STORAGE_TLS with this hint.
komando secret set corp-ca < corp-ca.crt
komando storage add minio 's3://AKIAEXAMPLE@media?endpoint=https://minio.corp.lan:9000&ca=secret:corp-ca' --ask-password
AWS logins (SSO, roles, temporary keys)
Instead of a stored key, a conn can use a profile from ~/.aws/config (default uses the usual AWS login chain). komando reads the profile itself, with no aws CLI needed, and fetches fresh keys each time, so SSO, assumed roles and temporary keys work as you set them up:
komando storage add backups 's3://my-bucket/db?region=eu-west-1' --option aws_profile=prod
AWS_LOGIN_REQUIRED: the SSO login has expired. A person runskomando login aws --profile prodonce. It opens the sign-in page and saves the login where the aws CLI keeps it, so both share it.AWS_PROFILE_NOT_FOUND: the profile is not in~/.aws/config.
Amazon ECR registries use AWS logins the same way (see Container registries).
Browse and read files
komando storage list backups # one level (up to 1000 entries; -n/--limit)
SIZE MODIFIED KEY
DIR - 2026/
48.2 MiB 2026-11-12 02:00 UTC app.sql.gz
komando storage list backups 2026/ --recursive # everything under 2026/
komando storage cat backups logs/app.log --tail 50 # read text without downloading it
komando storage cat backups config/app.env --head 20
storage list backups 2026andstorage list backups 2026/both list what is in the folder 2026, on every kind of storage. On a bucket, a prefix that names no folder (storage list backups logs/app-2026-11) lists the keys that start with it.- Listing a folder that is empty or does not exist is
FOLDER_NOT_FOUND(exit 3), on every kind of storage. The empty "folder marker" objects that S3 consoles create are left out of listings and downloads. catshows text only; binary isNOT_TEXT(exit 2), so download it instead. Use--heador--tail(one of them, 1 or more lines). It reads at most--max-bytes(1 MiB by default) and says on stderr when it cut the file.
Download and upload
komando download backups 2026/app.sql.gz # into the current folder
komando upload backups ./app.sql.gz 2026/app.sql.gz
backups: app.sql.gz (48.2 MiB)
uploaded ./app.sql.gz -> 2026/app.sql.gz (48.2 MiB), replaced the old object
Typed alone, komando download asks which server or storage, then the path.
komando download backups reports/q3.pdf --to ~/Downloads/ # into a folder
komando download backups logs/app.log --to - | less # to stdout
komando download backups reports -r --to ./reports # a whole folder
komando upload backups ./a.pdf reports/ # stores reports/a.pdf
komando upload backups ./reports reports -r # a whole folder
komando storage download and komando storage upload do the same for storage conns only, and komando cp writes the same copy as cp ./a.pdf backups:reports/. A folder upload (-r) sends only new and changed files, like komando sync.
- Downloads never overwrite a file on your computer unless you add
--overwrite. The file is readable only by you.--totakes a file name, a folder (one that exists, or a name ending in/: the file keeps its name inside), or-to stream it to stdout (any-o: komando's own answer then goes to stderr). A folder download keeps files that are already there. komando storage upload CONN - KEY(orupload CONN - KEY) streams stdin into KEY;--size Nmakes a stream of another length fail withSIZE_CONFLICTand replace nothing. See Stream a file through stdout or stdin.- Uploads replace an object with the same key; the result says
"replaced": true. A key ending in/is a folder. - On a protected conn,
uploadasks a person at a terminal first; an AI agent or a script adds--yesafter a person agrees. --dry-runsends nothing, but checks:uploadshows the key and whether it would replace an object,downloadwhere the file would go and its size.--continuegoes on with one file that was cut off. A download keeps the part already on your computer when it matches the object (sha256), fetches the rest and checks the whole file. An upload can go on only on an SFTP, FTP, FTPS or SMB conn; S3, Google Cloud Storage, Azure Blob and WebDAV store a file whole and cannot add to one, so a cut file there stops withRESUME_UNSUPPORTED(upload it again without--continue). Storage cannot work out the sum of part of an object, so komando reads the part already copied once more to check it.komando cpalso copies between two storage conns, or between a conn and a server:komando cp backups:2026/db.sql.gz dr-backups:2026/. The data streams through your computer and is never saved on its disk.- To keep a folder in step and send only new and changed files, use
komando sync(see Files):
komando sync ./site backups:site --exclude '*.tmp'
komando sync backups:2026/ ./restore
Share a file with a temporary link
komando storage link backups 2026/app.sql.gz --expires 24h # default 1h, at most 7d
https://my-bucket.s3.eu-west-1.amazonaws.com/db/2026/app.sql.gz?X-Amz-Algorithm=AWS4-HMAC-SHA256&...
komando storage link media site/report.pdf # Google Cloud and Azure too
komando storage link backups 2026/app.sql.gz --endpoint https://files.example.com
- For an AI agent,
storage linkneeds a person's yes (--reveal): a link is the file as it is, past the hiding thatstorage catandstorage downloadapply. Without it the command stops withSENSITIVE_FILE; for a file that is a secret by its name (.env, a key) it always does. - The link works for anyone who has it until it expires. Share it like a password. It is not written to the audit history.
- On a protected conn,
linkasks a person at a terminal first; an AI agent or a script adds--yesafter a person agrees. - The link uses the address in the conn URL. When komando reaches the storage through
--via, the result warns that people outside that network cannot open it. Use--endpointto sign it for the public address. - The download keeps the file's name, also with non-ASCII letters.
- A conn that logs in with an AWS profile (SSO, an assumed role) signs the link with temporary keys, so the link stops working when they expire, often after an hour, whatever
--expiressays. The result warns about it. For a link that lasts, give the conn an access key of its own.
Make folders, move and rename files
komando storage mkdir backups reports/2026 --dry-run # check first
komando storage mkdir backups reports/2026 # missing parents too
komando storage mv backups db/old.sql.gz archive/ # into a folder, same name
komando storage mv backups reports/draft.pdf reports/q3.pdf --overwrite
komando storage chmod backups 0640 config/app.yml # SFTP only
would move db/old.sql.gz -> archive/old.sql.gz (48.1 MiB, by a copy that is checked before the original is deleted; replaces a file: no)
mkdirmakes the folder and any missing folders above it. A folder that is already there is fine. S3, Google Cloud and Azure have no real folders:mkdirstores an empty folder marker (reports/2026/), as their web consoles do, sostorage listshows the empty folder.mvmoves one file or folder inside one conn. ADSTending in/is a folder: the file moves into it and keeps its name. A file already atDSTstops the move (FILE_EXISTS) unless you add--overwrite; a folder atDSTis never replaced.- On a file server (SFTP, FTP, FTPS, WebDAV, SMB)
mvis one rename on the server, and it moves folders too. Where the server cannot rename over a file,--overwritefirst moves the old file aside (.komando-old-NAME) and puts it back if the rename fails, so a failed move never loses it. - A path is written plainly:
.or//in it stops withUSAGE. - S3, Google Cloud and Azure cannot rename. There
mvcopies the object on the server, checks that the copy has the same size and checksum, and only then deletes the original (method: copy_then_deletein the result). If the check fails, the original stays and the copy is deleted (MOVE_FAILED). It moves one object at a time, not a folder (STORAGE_UNSUPPORTED). In a bucket that keeps old versions, the original's old versions stay. chmodsets the Unix mode of a file or folder, in digits (0644,640,2775), and the result says the old mode too. Only SFTP servers have modes; on any other kind it stops withSTORAGE_UNSUPPORTEDbefore komando contacts the storage.- All three are changes, like
upload: try them with--dry-run, a protected conn asks a person first (an AI agent or a script adds--yesafter a person agrees), and each run is inkomando audit.
Delete files
komando storage rm backups --prefix daily/ --older-than 30d --dry-run # list old backups
komando storage rm backups --prefix daily/ --older-than 30d # delete them
komando storage rm backups 2026/old.sql.gz # exact keys
SIZE MODIFIED KEY
48.1 MiB 2026-10-01 02:00 UTC daily/app-2026-10-01.sql.gz
48.0 MiB 2026-10-02 02:00 UTC daily/app-2026-10-02.sql.gz
would delete 2 objects (96.1 MiB)
Deleted objects are gone (unless the bucket keeps old versions, see below). At your terminal komando asks you first: you type the key's name, or for several objects how many. With --prefix it first lists what would go (the first 20 objects, the count and the size). Anything else cancels and deletes nothing. An AI agent or a script adds --allow-dangerous (and --yes on a protected conn) after a person agrees. See Safety.
- Without
--prefix,rmtakes exact keys only, no patterns. --prefixremoves everything under a folder (/for the whole conn);--older-than(30d,12h,90m) keeps the newer ones.--prefixrefuses to remove more than--max-removeobjects (1000 by default;TOO_MANY). Check the dry-run list, and raise the cap if that is what you mean.--dry-runlists the objects one per line with size and date.
Old versions (S3 versioning)
A bucket with versioning keeps every overwritten or deleted object, and rm leaves those behind (S3 adds a delete marker). See them, and remove a key with every version:
komando storage list backups app/ --all-versions # every version and delete marker
komando storage rm backups app/config.json --all-versions --dry-run
komando storage rm backups app/config.json --all-versions # really gone
--all-versions takes exact keys and works on S3 and S3-compatible stores; it asks first like any rm.
Add a Google Cloud or Azure bucket
komando storage add media gs://my-bucket/site # logs in like gcloud
komando secret set media-sa < key.json # or a service account key
komando conn edit media --password-ref secret:media-sa
komando secret set files-key # key1 from the portal, or a SAS token
komando storage add files azblob://mystorageacct@uploads/2026 --password-ref secret:files-key
- Google Cloud Storage without
--password-refuses the login gcloud keeps (gcloud auth application-default login), theGOOGLE_APPLICATION_CREDENTIALSfile, or the server's own account on Google Cloud.STORAGE_AUTHsays when there is none. A service account key is the JSON file from the console. - Azure Blob Storage takes the storage account's key (
key1orkey2) or a SAS token (the part after?, starting withsv=). A SAS token that can only read and list keeps komando to reading. - Links (
storage link) need a key that can sign them: a service account key for Google Cloud, the account key for Azure. gcloud's own login and a SAS token cannot. - An emulator or another cloud takes
?endpoint=URL, for exampleazblob://devstoreaccount1@media?endpoint=http://127.0.0.1:10000/devstoreaccount1for Azurite. Anhttp://endpoint on another computer sends the files (and for S3 the AWS session token) unencrypted, so it is refused (INSECURE_PROTOCOL) unless the conn goes--viaan SSH server or the URL adds&insecure=1. One on this computer (localhost, 127.0.0.1) is fine. - gcloud's own login goes only to Google (
https://…googleapis.com), never to an emulator or another endpoint. A service account key needs anhttps://endpoint: overhttp://its token would travel unencrypted, so komando refuses it (INSECURE_PROTOCOL). A SAS token is refused overhttp://for the same reason; the Azure account key only signs, so an emulator like Azurite works with it.
Add a file server (WebDAV, FTPS, SFTP, FTP)
Web hosting and older systems often give you only file access. Add the server as a conn:
komando secret set hosting-pass
komando storage add site 'ftps://deploy@files.example.com/public_html' --password-ref secret:hosting-pass
komando storage list site --recursive
komando upload site ./index.html index.html
komando download site logs/error.log
- Uploads go to a temporary name first and are renamed into place, so a failed upload never leaves half a file under the real name. Missing folders are created.
- SFTP checks the server's identity like any SSH server: it is remembered the first time, and a change is refused with
HOSTKEY_MISMATCH. SFTP can use your SSH keys as well as a password. - WebDAV makes missing folders as it uploads. For Nextcloud and ownCloud, the path is
remote.php/dav/files/USER, and an app password (Settings, Security) is safer than your own. - A WebDAV upload goes to a temporary name (
.komando-upload-…) and is moved into place with WebDAVMOVEonly when it arrived whole, so a cut upload never replaces the file there. The server must allowMOVE(nginx:dav_methods PUT DELETE MKCOL COPY MOVE;), and a proxy in front must keep the URL's scheme and address. If the server removes the old file and then fails the move, the new content stays under its temporary name (UPLOAD_NOT_RENAMEDnames it).
Add a Windows share (SMB)
A shared folder on a Windows server, Samba, a NAS or Azure Files (the \\fileserver\team you open in Explorer) is a conn too:
komando secret set team-share
komando storage add team 'smb://alice@fileserver.corp.lan/team/reports?domain=CORP' --password-ref secret:team-share
komando storage list team
komando upload team ./q3.pdf 2026/q3.pdf
- The URL:
smb://USER@HOST/SHARE/FOLDER. The first part of the path is the share's name (team); the rest is the folder the conn starts in.cifs://means the same. - A domain account (
CORP\alice): add?domain=CORP. The usual SMB formsmb://CORP;alice@host/shareworks too; use one of them, not both. A local account on the server needs no domain. - The password goes in the vault (
--password-ref), never in the URL. komando logs in with NTLMv2. - Safe on the wire: komando speaks SMB 2 and 3 and signs every message, so nobody on the way can change what the server sends. The traffic is encrypted when the server asks for it (SMB 3 encryption, which Azure Files turns on by default; on Windows, "Encrypt data access" on the share; on Samba,
smb encrypt = required). Without it,komando doctorwarns about conns that cross the network. - Port 445 is often blocked across the internet. Reach the server
--viaan SSH server in its network, or through a VPN, like any other conn. - Azure Files:
smb://STORAGEACCOUNT@STORAGEACCOUNT.file.core.windows.net/SHAREwith the storage account's key as the password. - Uploads go to a temporary name first. An existing file is moved aside, the new one renamed into place, and the old one removed only then; if the rename fails, the old file comes back.
Check, change, rename or remove a storage
A storage is a conn, so the conn commands work on it:
komando list kind:storage # your storages
komando test backups # can komando reach it and log in?
komando conn show backups # its URL, way in and password reference
komando conn edit backups --url 's3://AKIAEXAMPLE@my-bucket/db?region=eu-central-1'
komando conn edit backups --via web1 # reach it through a bastion or a VPN
komando conn edit backups --protected # every change then needs a person's yes
komando conn rename backups db-backups
komando conn rm backups # komando forgets it; the files stay
--via works the same as for other conns: through a bastion or a VPN.
Limits
- Keys cannot leave the conn's folder (
../is refused). storage mvstays inside one conn, and on S3, Google Cloud and Azure it moves one object at a time;storage chmodis for SFTP conns only.storage catshows text only, at most--max-bytes(1 MiB by default).storage rmwithout--prefixtakes exact keys, no patterns; with--prefixit stops above--max-removeobjects (1000 by default) and above a million objects under the prefix.- Buckets that keep old versions (S3 versioning, Google Cloud object versioning or soft delete, Azure blob versioning or soft delete):
rmremoves the current object only. The provider keeps the old versions (S3 adds a delete marker), they still cost storage, and they can be brought back in the provider's console or CLI. On S3,--all-versionslists and removes them (see Old versions); on Google Cloud and Azure komando does not, and a lifecycle rule on the bucket does. - File servers (WebDAV, FTPS, SFTP, FTP, SMB) have no temporary links:
storage linkis for S3, Google Cloud and Azure. gcloud's own login and an Azure SAS token cannot sign a link either. - A link signed with temporary AWS keys stops working when they expire.
- SMB: Kerberos tickets are not used, and a guest login cannot sign, so a user name is required.
- FTP and FTPS: a listing can end early and still look complete. On plain FTP, and on FTPS when the connection closes after the encryption is set up, the only sign is the server's answer at the end, and a server that says "226 Transfer complete" anyway is believed. komando stops when the connection closes before the encryption is set up, and
sync --deletestops before it empties a folder the source lists as empty (EMPTY_FOLDER_CONFIRM_REQUIRED, see files.md). A folder that only lists some of its files is not caught: runsync --deletefrom an FTP or FTPS source with--dry-runfirst and read what it would delete.
Troubleshooting
| Error | What it means | What to do |
|---|---|---|
STORAGE_AUTH | the storage refused the login, or there is none (Google Cloud) | check the key with komando conn show backups, or log in with gcloud |
STORAGE_CONNECT | komando could not reach the bucket or file server | komando test backups; reach it --via a server or a VPN |
STORAGE_TLS | the certificate does not check out | name your CA with ?ca=secret:NAME |
STORAGE_ERROR | for example, another program has the file open | close it there and run it again |
BUCKET_NOT_FOUND | the bucket (or SMB share) does not exist | check the name in the conn URL |
FOLDER_NOT_FOUND | the folder is empty or does not exist (exit 3) | check it with komando storage list backups |
OBJECT_NOT_FOUND | no such key | komando storage list backups PREFIX shows the keys |
NOT_TEXT | storage cat of a binary file (exit 2) | download it instead |
FILE_EXISTS | the download would overwrite a file on this computer | pick another --to, or add --overwrite |
TOO_MANY | more objects match than --max-remove | narrow --prefix or --older-than, or raise --max-remove after checking the list |
INSECURE_PROTOCOL | the URL sends the login or the files unencrypted across the network | use the TLS form (webdavs://, ftps://, https://), --via, or add ?insecure=1 |
AWS_LOGIN_REQUIRED, AWS_PROFILE_NOT_FOUND | the AWS SSO login expired, or the profile is missing | a person runs komando login aws --profile prod; or fix aws_profile |
HOSTKEY_MISMATCH | an SFTP server's identity changed | do not change anything; report it, it may be an attack |
POLICY_BLOCKED | rm without --allow-dangerous (exit 6) | run it at a terminal, or add the flag after a person agrees |
Every code is in Error codes.
Source: docs/features/storage.md in sgnd/komando at commit b622784.