I wanna create a user had random password for FTP in Docker. The section of Dockerfile like below:
RUN useradd web
RUN export ftppass=`cat /proc/sys/kernel/random/uuid`
RUN echo -e "$ftppass\n$ftppass" | passwd web
But I got an error in last line:
New password: Retype new password: Sorry, passwords do not match.
passwd: Authentication token manipulation error
passwd: password unchanged
Why the passwords do not match even I using a same variable?
update:
I found the output of echo -e "$ftppass\n$ftppass"
is:
Step 9/15 : RUN echo -e "$ftppass\n$ftppass"
---> Running in ddd97df41d85
-e
Removing intermediate container ddd97df41d85
---> a64b606ea898
Step 10/15 : ...
Why it's not works for echo -e
and where are my $ftppass?
Resolved, the new section of Dockerfile is:
RUN useradd web
RUN cat /proc/sys/kernel/random/uuid > /etc/vsftp-password
RUN echo "web:"`cat /etc/vsftp-password` | chpasswd
RUN echo "ftp info web:"`cat /etc/vsftp-password`
Thanks anyone and happy new year~