Created
November 3, 2022 02:59
-
-
Save Fiwi1265/57a408b19d9023dd501e80f50723b405 to your computer and use it in GitHub Desktop.
Arch Linux based GitHub Codespaces
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 archlinux:latest | |
# Install dependencies | |
RUN pacman -Syyu --noconfirm sudo openssh bash-completion nano git | |
# Generate host keys | |
RUN /usr/bin/ssh-keygen -A | |
# Add defualt user | |
RUN useradd vscode | |
RUN mkdir -p /home/vscode/.ssh | |
RUN chmod -R 700 /home/vscode/.ssh/ | |
RUN echo "YOUR_SSH_PUBLIC_KEY" > home/vscode/.ssh/authorized_keys | |
RUN chmod 600 /home/vscode/.ssh/authorized_keys | |
RUN chown -R vscode:vscode /home/vscode/ | |
RUN usermod -aG wheel vscode | |
RUN echo 'vscode:1234' | chpasswd | |
# Add password to root user | |
RUN echo 'root:1234' | chpasswd | |
# Config sshd | |
RUN sed -i -e 's/^#PasswordAuthentication yes/PasswordAuthentication no/g' /etc/ssh/sshd_config | |
RUN sed -i -e 's/^#PubkeyAuthentication yes/PubkeyAuthentication yes/g' /etc/ssh/sshd_config | |
RUN sed -i -e 's/^UsePAM yes/UsePAM no/g' /etc/ssh/sshd_config | |
# Run openssh daemon | |
CMD ["/usr/sbin/sshd", "-D"] | |
# Set default user | |
USER vscode |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment