skip to Main Content

ERROR: Service ‘remote_host’ failed to build: The command ‘/bin/sh -c echo "1234" | passwd remote_user –stdin’ returned a non-zero code: 127

FROM centos

RUN yum -y install openssh-server

RUN useradd remote_user
RUN echo "1234" | passwd remote_user  --stdin
RUN mkdir /home/remote_user/.ssh
RUN chmod 700 /home/remote_user/.ssh

COPY remote-key.pub /home/remote_user/.ssh/authorized_keys

RUN chown remote_user:remote_user   -R /home/remote_user && 
    chmod 600 /home/remote_user/.ssh/authorized_keys

RUN /usr/sbin/sshd-keygen > /dev/null 2>&1

RUN yum -y install mysql

RUN yum -y install epel-release && 
    yum -y install python-pip && 
    pip install --upgrade pip && 
    pip install awscli

CMD /usr/sbin/sshd -D

2

Answers


  1. To set a password for the user remote_user, you can update the RUN statement as follow

    RUN echo remote_user:1234 |/usr/sbin/chpasswd
    
    Login or Signup to reply.
  2. To set password for the remote_user, we can use

    RUN echo remote_user:1234 | chpasswd
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search