docker icon indicating copy to clipboard operation
docker copied to clipboard

NEXTCLOUD_ADMIN_PASSWORD can't have spaces

Open jdorel opened this issue 5 years ago • 4 comments
trafficstars

When setting the env var NEXTCLOUD_ADMIN_PASSWORD with a password containing spaces, I get the following debug message :

/entrypoint.sh: 30: local: straggler": bad variable name

This is annoying because I'd like to use a passphrase.

jdorel avatar Apr 23 '20 20:04 jdorel

Not sure what I propose will work, but looking at the entrypoint.sh file, you might be able to create a file containing your password containing spaces. Reference the path to your file with the variable NEXTCLOUD_ADMIN_PASSWORD_FILE, the path being a path inside the docker container of course.

But having a variable value with space is always a pain in scripts language. Perhaps the easier way is to remove space in your passphrase. I am using passphrase too, but without space in it.

Hoe this helps.

doc75 avatar May 04 '20 20:05 doc75

I also hit this, when trying to deploy using https://github.com/nextcloud/helm with the following values.yaml file:

nextcloud:
  password: "test test test"

invidian avatar Sep 22 '20 16:09 invidian

I confirm the same with the latest stable image (19.0.3) ; here is the trace with set -vx (line 32 displayed here is actually 30 because I added 2 lines for debug) :

nextcloud_nextcloud.1.hl349n0m6tri@machine7    | + echo Initializing nextcloud 19.0.3.1 ...
nextcloud_nextcloud.1.hl349n0m6tri@machine7    | + [ 0.0.0.0 != 0.0.0.0 ]
nextcloud_nextcloud.1.hl349n0m6tri@machine7    | + echo Initializing finished
nextcloud_nextcloud.1.hl349n0m6tri@machine7    | + [ 0.0.0.0 = 0.0.0.0 ]
nextcloud_nextcloud.1.hl349n0m6tri@machine7    | + echo New nextcloud instance
nextcloud_nextcloud.1.hl349n0m6tri@machine7    | + file_env NEXTCLOUD_ADMIN_PASSWORD
nextcloud_nextcloud.1.hl349n0m6tri@machine7    | + set -vx
nextcloud_nextcloud.1.hl349n0m6tri@machine7    | + local var=NEXTCLOUD_ADMIN_PASSWORD
nextcloud_nextcloud.1.hl349n0m6tri@machine7    | + local fileVar=NEXTCLOUD_ADMIN_PASSWORD_FILE
nextcloud_nextcloud.1.hl349n0m6tri@machine7    | + local def=
nextcloud_nextcloud.1.hl349n0m6tri@machine7    | + env
nextcloud_nextcloud.1.hl349n0m6tri@machine7    | + + sed -E -egrep s/^NEXTCLOUD_ADMIN_PASSWORD=// -E
nextcloud_nextcloud.1.hl349n0m6tri@machine7    |  ^NEXTCLOUD_ADMIN_PASSWORD=
nextcloud_nextcloud.1.hl349n0m6tri@machine7    | + local varValue=one two three
nextcloud_nextcloud.1.hl349n0m6tri@machine7    | /entrypoint.sh: 32: local: three: bad variable name

I've managed to make it work by double-quoting the lines in entrypoint.sh but there may be more elegant/robust approaches :

    local varValue="`env | grep -E \"^${var}=\" | sed -E -e \"s/^${var}=//\"`"
    local fileVarValue="`env | grep -E \"^${fileVar}=\" | sed -E -e \"s/^${fileVar}=//\"`"

nicobo avatar Oct 04 '20 14:10 nicobo

I can't reproduce this problem. Can one of you provide a basic Compose file or run command that reproduces this problem?

EDIT: For the record, this works:

docker run -d -p 9991:80 -e SQLITE_DATABASE=ncdb -e NEXTCLOUD_ADMIN_USER=ncadmin -e NEXTCLOUD_ADMIN_PASSWORD="test test test" nextcloud

joshtrichards avatar Jun 19 '24 20:06 joshtrichards