Unable to generate passwords using ./gen-passwords.sh

Hi I’m attempting to deploy docker-jitsi-meet on Ubuntu 22.04

However, after giving permissions to execute the bash script inside the docker-jitsi-meet folder:

cd docker-jitsi-meet
sudo chmod +x gen-passwords.sh

I’m getting ,

gen-passwords.sh: command not found

I then tried

bash gen-passwords.sh

and I now get the following set of errors :

gen-passwords.sh: line 2: $'\r': command not found
gen-passwords.sh: line 3: syntax error near unexpected token `$'{\r''
'en-passwords.sh: line 3: `function generatePassword() {

I havent changed anything in the script :slight_smile:

Here it is anyways:

#!/usr/bin/env bash

function generatePassword() {
    openssl rand -hex 16
}

JICOFO_AUTH_PASSWORD=$(generatePassword)
JVB_AUTH_PASSWORD=$(generatePassword)
JIGASI_XMPP_PASSWORD=$(generatePassword)
JIBRI_RECORDER_PASSWORD=$(generatePassword)
JIBRI_XMPP_PASSWORD=$(generatePassword)

sed -i.bak \
    -e "s#JICOFO_AUTH_PASSWORD=.*#JICOFO_AUTH_PASSWORD=${JICOFO_AUTH_PASSWORD}#g" \
    -e "s#JVB_AUTH_PASSWORD=.*#JVB_AUTH_PASSWORD=${JVB_AUTH_PASSWORD}#g" \
    -e "s#JIGASI_XMPP_PASSWORD=.*#JIGASI_XMPP_PASSWORD=${JIGASI_XMPP_PASSWORD}#g" \
    -e "s#JIBRI_RECORDER_PASSWORD=.*#JIBRI_RECORDER_PASSWORD=${JIBRI_RECORDER_PASSWORD}#g" \
    -e "s#JIBRI_XMPP_PASSWORD=.*#JIBRI_XMPP_PASSWORD=${JIBRI_XMPP_PASSWORD}#g" \
    "$(dirname "$0")/.env"

Sounds like a problem with linefeed format in the file. Was it copied over from a Windows machine?

If so, you can fix the line feeds using:

dos2unix gen-passwords.sh
1 Like

Hi Shawn,

The packaged docker-jitsi-meet.7z files were just transferred from windows to ubuntu 22.04 on gcp 22.04. I changed nothing in the file itself for there is no reason to do so if its a working script. Still the problem can arise ?

Yes. Text files in windows use different line ending char from Unix/Linux. Some transfer methods would automatically change the chars to suit the target host, but since you transferred it within a 7zip file that would not have happened.

Have you tried the dos2unix command?

The doc2unix command worked. Also was able to generate new passwords this time. Thank you shawn. I’m also struggling on this part. Could you take some time to help ? I’m asking cause it maybe related this this conversion to unix issue itself.