docs/content/iclouddrive.md
The initial setup for an iCloud backend involves getting a trust token/session. This uses your regular Apple ID password plus 2FA, either from a trusted device prompt or an SMS code sent to a trusted phone number.
IMPORTANT: App-specific passwords are not accepted. Only use your regular Apple ID password and 2FA.
This backend serves two Apple services:
drive - iCloud Drive (default)photos - iCloud Photosrclone config walks you through the token creation. The trust token is valid
for 30 days. After which you will have to reauthenticate with rclone reconnect
or rclone config.
rclone authenticates with Apple using SRP (Secure Remote Password), the same protocol used by the iCloud web interface. Your password is never sent to Apple's servers -- instead, a cryptographic proof is exchanged that verifies you know the password without revealing it.
The authentication flow is:
Here is an example of how to make a Photos remote called icloudphotos.
For iCloud Drive, leave service at its default drive value. First run:
rclone config
This will guide you through an interactive setup process:
No remotes found, make a new one?
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n
name> icloudphotos
Option Storage.
Type of storage to configure.
Choose a number from below, or type in your own value.
[snip]
XX / iCloud Drive
\ (iclouddrive)
[snip]
Storage> iclouddrive
Option service.
iCloud service to use.
Choose a number from below, or type in your own value of type string.
Press Enter for the default (drive).
1 / iCloud Drive
\ (drive)
2 / iCloud Photos
\ (photos)
service> 2
Option apple_id.
Apple ID.
Enter a value.
apple_id> APPLEID
Option password.
Password.
Choose an alternative below.
y) Yes, type in my own password
g) Generate random password
y/g> y
Enter the password:
password:
Confirm the password:
password:
Edit advanced config?
y) Yes
n) No (default)
y/n> n
Option config_2fa.
Two-factor authentication: enter your 2FA code or type 'sms' for a text message
Enter a value.
config_2fa> 2FACODE
Remote config
--------------------
[icloudphotos]
- type: iclouddrive
- service: photos
- apple_id: APPLEID
- password: *** ENCRYPTED ***
- cookies: ****************************
- trust_token: ****************************
--------------------
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y
The iCloud Drive backend also supports accessing iCloud Photos by setting the
service option to photos:
rclone lsd iclouddrive: --iclouddrive-service photos
This presents a read-only hierarchy rooted at photo libraries:
PrimarySync) and
any Shared Photo Library (SharedSync-XXXX).MOV
companionsExamples:
# List libraries
rclone lsd iclouddrive: --iclouddrive-service photos
# List albums in your primary library
rclone lsd iclouddrive:PrimarySync/ --iclouddrive-service photos
# List photos in an album
rclone ls iclouddrive:PrimarySync/All\ Photos/ --iclouddrive-service photos
# Download a photo
rclone copy iclouddrive:PrimarySync/Favorites/IMG_0001.HEIC /tmp/ --iclouddrive-service photos
You can either:
service = photos in rclone config for a dedicated Photos remoteservice = drive and pass --iclouddrive-service photos when neededWith --metadata, Photos entries expose these read-only metadata keys:
widthheightadded-timefavoritehiddenThese metadata keys are only available when service = photos.
iCloud Photos caches album listings to disk for fast subsequent access.
On the first run, listing a large album uses parallel startRank
partitions to fetch pages concurrently. After that, a lightweight change
check (~200ms) determines whether the cache is still valid.
Cache location: ~/.cache/rclone/iclouddrive-photos/<remote>/<zone>/
To clear the cache: delete that directory or run rclone config reconnect.
For mounting iCloud Photos via rclone mount, the following flags
are recommended:
rclone mount remote: /mnt/photos \
--iclouddrive-service photos \
--vfs-refresh \
--dir-cache-time 1h \
--vfs-cache-mode full \
--attr-timeout 1m \
--read-only
--vfs-refresh pre-warms directory caches in the background on mount
start so that albums are ready when you browse them--dir-cache-time 1h extends the in-memory cache lifetime beyond the
default 5 minutes (change detection is fast, so this is safe)--vfs-cache-mode full caches downloaded photos and videos to local
disk for fast repeated access--attr-timeout 1m reduces kernel attribute lookups (safe because
the backend is read-only)--read-only prevents confusing write errorsThe first listing of a very large album (e.g. 75,000 items in "All Photos") can take several minutes due to API pagination limits. This happens once — subsequent listings use the disk cache.
iCloud Photos is read-only. Upload, delete, rename, and move operations are not supported.
Advanced Data Protection is supported.
On iPhone, Settings > Apple Account > iCloud > 'Access iCloud Data on the Web'
must be ON.
If ADP is enabled on your account, rclone requests PCS cookies after 2FA. Apple may require approval on a trusted device before those cookies are issued.
If you see Missing PCS cookies from the request or a requestPCS: error,
the ADP approval flow did not complete successfully.
Check that 'Access iCloud Data on the Web' is enabled and approve any prompt on your trusted device.
Then run rclone reconnect remote:.
If the remote still has stale auth state, clear the cookies and
trust_token fields in the config, or delete and recreate the remote.
Here are the Standard options specific to iclouddrive (iCloud Drive and Photos).
iCloud service to use.
Properties:
Apple ID.
Properties:
Password.
NB Input to this must be obscured - see rclone obscure.
Properties:
Trust token for session authentication.
Properties:
Session cookies.
Properties:
Here are the Advanced options specific to iclouddrive (iCloud Drive and Photos).
Client ID for iCloud API access.
Properties:
The encoding for the backend.
See the encoding section in the overview for more info.
Properties:
Description of the remote.
Properties:
Metadata is read-only and available for the Photos service only.
Here are the possible system metadata items for the iclouddrive backend.
| Name | Help | Type | Example | Read Only |
|---|---|---|---|---|
| added-time | Time the item was added to the iCloud library | RFC 3339 | 2006-01-02T15:04:05Z | Y |
| favorite | Whether the item is marked as favorite | bool | Y | |
| height | Image height in pixels | int | Y | |
| hidden | Whether the item is hidden | bool | Y | |
| width | Image width in pixels | int | Y |
See the metadata docs for more info.
<!-- autogenerated options stop -->