FROM fedora:22
MAINTAINER sahas

RUN dnf install -y openssh-server x2goserver x2goserver-xsession firefox emacs

RUN (mkdir -p /var/run/sshd && \
     sed -ri 's/UseDNS yes/#UseDNS yes/g' /etc/ssh/sshd_config && \
     echo "UseDNS no" >> /etc/ssh/sshd_config)

RUN (useradd -m docker && \
     mkdir -p /home/docker/.ssh && \
     chmod 700 /home/docker/.ssh && \
     chown docker:docker /home/docker/.ssh && \
     mkdir -p /etc/sudoers.d)

ADD ./999-sudoers-docker /etc/sudoers.d/999-sudoers-docker
RUN chmod 440 /etc/sudoers.d/999-sudoers-docker

RUN echo 'root:ch@ngem3' | chpasswd
RUN echo 'docker:ch@ngem3' | chpasswd

RUN /usr/bin/ssh-keygen -A

COPY startup.bash /root/startup.bash
RUN chmod +x /root/startup.bash
EXPOSE 22
#ENTRYPOINT ["/usr/sbin/sshd", "-De"]
CMD ["/root/startup.bash"]
