mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-05 19:20:12 +08:00
feat: clean up /etc/skel and move ssh key to /etc/ssh/authorized_keys/
This commit is contained in:
1 parent
31301419ad
commit
58354b7cd8
3 files changed
+8
-7
No files matched your search
@@ -37,7 +37,7 @@ Include /etc/ssh/sshd_config.d/*.conf
|
||||
PubkeyAuthentication yes
|
||||
|
||||
# Expect .ssh/authorized_keys2 to be disregarded by default in future.
|
||||
#AuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys2
|
||||
AuthorizedKeysFile /etc/ssh/authorized_keys/%u
|
||||
|
||||
#AuthorizedPrincipalsFile none
|
||||
|
||||
|
||||
@@ -22,6 +22,8 @@ ENV NODE_PATH=/usr/src/node_modules
|
||||
COPY ./packages/container /usr/local/lib/container
|
||||
COPY ./quests/.includes/zshrc /etc/zsh/zshrc
|
||||
RUN rm -f /etc/motd /etc/issue /etc/issue.net /etc/update-motd.d/*
|
||||
RUN rm -rf /etc/skel && mkdir -p /etc/skel
|
||||
RUN mkdir -p /etc/ssh/authorized_keys && chmod 755 /etc/ssh/authorized_keys
|
||||
COPY ./quests/.includes/sshd_config /etc/ssh/sshd_config
|
||||
|
||||
EXPOSE 22
|
||||
|
||||
@@ -5,13 +5,12 @@ USERNAME=commander
|
||||
if ! id -u ${USERNAME} >/dev/null 2>&1; then
|
||||
adduser --disabled-password --gecos '' --shell /bin/zsh ${USERNAME} && \
|
||||
find / -name ".gitkeep" -type f -exec rm -f {} +
|
||||
mkdir -p /home/${USERNAME}/.ssh && \
|
||||
cp /ssh_key.pub /home/${USERNAME}/.ssh/authorized_keys && \
|
||||
chmod 600 /home/${USERNAME}/.ssh/authorized_keys && \
|
||||
chmod 700 /home/${USERNAME}/.ssh && \
|
||||
chown -R ${USERNAME}:${USERNAME} /home/${USERNAME}/.ssh
|
||||
|
||||
PUB_KEY=/etc/ssh/authorized_keys/${USERNAME}
|
||||
cp /ssh_key.pub ${PUB_KEY}
|
||||
chmod 644 ${PUB_KEY}
|
||||
fi
|
||||
|
||||
mkdir /run/sshd
|
||||
mkdir -p /run/sshd
|
||||
echo "Starting SSH server"
|
||||
/usr/sbin/sshd -D -e
|
||||
Reference in new issue
Block a user