Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JustinSDK/76ecb98ba057ff329061 to your computer and use it in GitHub Desktop.
Save JustinSDK/76ecb98ba057ff329061 to your computer and use it in GitHub Desktop.
Dockerfile for SSHD with Ubuntu on RPi2
# sshd
# VERSION: 0.0.2
# origin:
# MAINTAINER Sven Dowideit <SvenDowideit@docker.com>
# https://docs.docker.com/examples/running_ssh_service/
#
# modified by: Wei Lin
# date: 2015/9/2
# Pull base image.
FROM armv7/armhf-ubuntu:14.04
MAINTAINER Wei Lin
ENV TERM linux
# Install SSH
RUN apt-get update && \
apt-get install -y openssh-server && \
mkdir /var/run/sshd
# root password and login permission / use user pi instead
# RUN echo 'root:raspberry' | chpasswd
# RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config
# Add user pi
RUN useradd -G adm,sudo,users -s /bin/bash -m pi && \
echo 'pi:raspberry' | chpasswd
# SSH login fix. Otherwise user is kicked off after login
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
# Upgrade and clean up
RUN apt-get dist-upgrade -y && \
apt-get autoremove -y && \
apt-get autoclean -y && \
apt-get clean -y && \
rm -rf /var/lib/apt/lists/*
# Environment variables
RUN echo " " >> /etc/profile && \
echo "#_____________________" >> /etc/profile && \
echo "force_color_prompt=yes" >> /etc/profile && \
echo "alias cls='clear'" >> /etc/profile && \
echo "export TERM=linux" >> /etc/profile
# Expose port 22
EXPOSE 22
# Define default command.
CMD ["/usr/sbin/sshd", "-D"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment