Search code examples
azureazure-web-app-servicelftp

Handling $ sign in username in lftp


I'm trying to deploy website to Azure App Service from an Alpine Linux box using lftp. The username is always in the form usr\$usr. For whatever reason lftp (version 4.7.6-r0) is using only usr\ part. The command I'm using is using variables.

lftp -c "set ssl:verify-certificate on && set ftp:ssl-force on && open -u $FTP_USER,$FTP_PASSWORD $FTP_SERVER && mirror -vvv -R -e --scan-all-first --transfer-all --overwrite --parallel=24 ./wwwroot $FTP_LOCATION"

So the $ in username is not actually part of the command, but inside variable, thus the $usr is not treated as variable.

Looks like it's the combination of \ and $ that somehow confuses lftp. Any ideas how to pass credentials differently? Or escape it.

I tried also ftp://$FTP_USER:$FTP_PASSWORD@$FTP_SERVER, but that didn't help. Same with usr\\$usr or usr\\\$usr.


Solution

  • The problem is not lftp, but GitLab CI. The dollar sign needs to be quoted there by another $. I described it here.