Skip to content
Advertisement

Got error “passwords do not match” using passwd in docker [closed]

I wanna create a user had random password for FTP in Docker. The section of Dockerfile like below:

JavaScript

But I got an error in last line:

JavaScript

Why the passwords do not match even I using a same variable?


update:

I found the output of echo -e "$ftppassn$ftppass" is:

JavaScript

Why it’s not works for echo -e and where are my $ftppass?


Resolved, the new section of Dockerfile is:

JavaScript

Thanks anyone and happy new year~

Advertisement

Answer

Instead of using passwd in a creative way, you should rather look at its manual page, which mentions chpasswd in the See Also section.

The passwd command is meant for interactive use, and it doesn’t read its input like most other programs, since the input is not echoed to the screen.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement