Created
April 21, 2015 02:01
-
-
Save seikoudoku2000/81633f2702ff8370bb97 to your computer and use it in GitHub Desktop.
Dockerfile with nopassword ssh for Ubuntu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu | |
# install necessory packages | |
RUN apt-get update | |
RUN apt-get install ssh -y | |
RUN apt-get install openssh-server -y | |
RUN apt-get install sudo -y | |
RUN apt-get install vim -y | |
RUN apt-get install curl -y | |
RUN apt-get install python-software-properties -y | |
RUN apt-get install software-properties-common -y | |
RUN add-apt-repository ppa:nginx/stable -y | |
RUN mkdir -p /var/run/sshd | |
# create user for ssh | |
RUN useradd -d /home/yosuke -m yosuke | |
RUN passwd -d -u yosuke | |
# setting ssh key | |
RUN mkdir -p /home/yosuke/.ssh | |
RUN chown yosuke /home/yosuke/.ssh | |
RUN chmod 700 /home/yosuke/.ssh | |
ADD ./authorized_keys /home/yosuke/.ssh/ | |
RUN chown yosuke /home/yosuke/.ssh/authorized_keys | |
RUN chmod 600 /home/yosuke/.ssh/authorized_keys | |
# allow sudo without password | |
RUN echo "yosuke ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers | |
EXPOSE 22 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment