Skip to content

Instantly share code, notes, and snippets.

@ymsrk
Created December 26, 2016 05:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ymsrk/1911e753be87ee4f97e94afe7eb99735 to your computer and use it in GitHub Desktop.
Save ymsrk/1911e753be87ee4f97e94afe7eb99735 to your computer and use it in GitHub Desktop.
CentOS で root 権限を持ち、sudo を実行できるユーザーを作成する
FROM centos:centos6.8
# update & clean
RUN yum update -y; yum clean all;
# install sudo
RUN yum install -y sudo; yum clean all;
# root setup passwd
RUN echo "root:abc1234" | chpasswd
# create user
RUN groupadd -g 5000 dev-sec && \
useradd -c 'dev-sec user' -d /home/dev-sec -g dev-sec -m dev-sec && \
echo "dev-sec:abc1234" | chpasswd
# sudo user
RUN echo 'dev-sec ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
USER dev-sec
WORKDIR /home/dev-sec
CMD ["/bin/bash"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment