Can we set user/password from `rclone serve` with environment variables?

What is the problem you are having with rclone?

I would like to set the user/password from a rclone serve command using environment variables, rather than using the --user and --pass flag. Something like RCLONE_SERVE_AUTHKEYS. Documentation makes no mention of serve commands, so I’m not sure how to proceed, or if the feature even exist

Run the command 'rclone version' and share the full output of the command.

rclone v1.71.2-DEV

  • os/version: arch (64 bit)
  • os/kernel: 6.18.2-arch2-1 (x86_64)
  • os/type: linux
  • os/arch: amd64
  • go/version: go1.25.3 X:nodwarf5
  • go/linking: dynamic
  • go/tags: none

Which cloud storage system are you using? (eg Google Drive)

S3 (serve)

welcome to the forum,

based on the example in rclone docs

@set RCLONE_AUTH_KEY="ACCESS_KEY_ID,SECRET_ACCESS_KEY"

rclone serve s3 d:\zork -vv 
DEBUG : Setting --auth-key "ACCESS_KEY_ID,SECRET_ACCESS_KEY" from environment variable RCLONE_AUTH_KEY="\"ACCESS_KEY_ID,SECRET_ACCESS_KEY\""
DEBUG : Setting  auth_key="\"ACCESS_KEY_ID,SECRET_ACCESS_KEY\"" from environment variable RCLONE_AUTH_KEY
DEBUG : Setting --config "d:\\data\\rclone\\rclone.conf" from environment variable RCLONE_CONFIG="d:\\data\\rclone\\rclone.conf"
DEBUG : rclone: Version "v1.71.2" starting with parameters ["d:\\data\\rclone\\rclone.exe" "serve" "s3" "d:\\zork" "-vv"]
DEBUG : Creating backend with remote "d:\\zork"
DEBUG : Using config file from "d:\\data\\rclone\\rclone.conf"
DEBUG : fs cache: renaming cache item "d:\\zork" to be canonical "//?/d:/zork"
DEBUG : Local file system at //?/d:/zork: Using hash md5 for ETag
INFO  : Local file system at //?/d:/zork: poll-interval is not supported by this remote
NOTICE: Local file system at //?/d:/zork: Starting s3 server on [http://127.0.0.1:8080/]
DEBUG : serve s3: LIST BUCKET
DEBUG : serve s3: bucketname:%!(EXTRA string=zork, string=prefix:, gofakes3.Prefix=prefix:"", delim:"", string=page:, string={Marker: HasMarker:false MaxKeys:1000})

rclone tree serves3: -vv
DEBUG : rclone: Version "v1.71.2" starting with parameters ["rclone" "tree" "serves3:" "-vv"]
DEBUG : Creating backend with remote "serves3:"
DEBUG : Using config file from "d:\\data\\rclone\\rclone.conf"
DEBUG : S3 root: Disabling multipart uploads
DEBUG : Stat: filePath="/"
DEBUG : >Stat: fi=, err=<nil>
DEBUG : ReadDir: dir=/
DEBUG : >ReadDir: names=[zork], err=<nil>
DEBUG : Stat: filePath="\\zork"
DEBUG : >Stat: fi=zork, err=<nil>
DEBUG : ReadDir: dir=\zork
DEBUG : >ReadDir: names=[file.ext], err=<nil>
DEBUG : Stat: filePath="\\zork\\file.ext"
DEBUG : >Stat: fi=zork\file.ext, err=<nil>
/
└── zork
    └── file.ext

1 directories, 1 files

Thanks !

Is it normal that the variables is not mentioned in rclone serve s3 ?

1 Like

welcome


Every option in rclone can have its default set by environment variable