Created
December 26, 2016 05:07
-
-
Save ymsrk/1911e753be87ee4f97e94afe7eb99735 to your computer and use it in GitHub Desktop.
CentOS で root 権限を持ち、sudo を実行できるユーザーを作成する
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 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