Skip to main content

Headless Auth and Service Accounts

Production jobs should not depend on interactive browser prompts. Use service identities and predictable runtime config.

Headless Strategy

PatternUse caseNotes
Service account JSONGCS/Drive automationRotate keys regularly
Environment authS3-compatible systemsKeep secrets out of shell history
Managed config fileSystemd/cron jobsExplicit --config path

Example: Explicit Config Path

rclone sync /srv/data remote-prod:backup/data \
--config /etc/rclone/rclone.conf \
--log-file /var/log/rclone-sync.log

Example: Environment Credentials

rclone-env-auth.sh
export AWS_ACCESS_KEY_ID="REDACTED"
export AWS_SECRET_ACCESS_KEY="REDACTED"
rclone lsd :s3,env_auth:true:my-bucket
warning

Never hardcode secrets in committed scripts. Store credentials in protected environment files or secret managers.

Minimal Hardening Checklist

  • Restrict config file permissions (chmod 600).
  • Use separate remotes for staging and production.
  • Keep backup credentials least-privilege.
  • Log to file and monitor for auth failures.

Common Pitfalls

PitfallFailure modeFix
Running config as root, job as non-rootConfig not found in runtimeUse shared path with --config
Broad admin credentialsBlast radius too largeCreate scoped backup-only policy
No token refresh planJob stops weeks laterDocument and test reconnect procedure

What's Next