Skip to content

Commit f6a30c1

Browse files
committed
Make AllowedUsers configurable in sshd_config
docker/root/usr/bin/entrypoint already allows for the specification of USER, USER_UID, USER_GID. But since AllowedUsers is hardcoded in sshd_config, one cannot log in as a user different ftom git. This change substitutes ${USER} for git in the sshd_config template. Signed-off-by: Jeronimo Pellegrini <[email protected]>
1 parent 5fcef38 commit f6a30c1

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

docker/root/etc/templates/sshd_config

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ ChallengeResponseAuthentication no
2525
PasswordAuthentication no
2626
PermitEmptyPasswords no
2727

28-
AllowUsers git
28+
AllowUsers ${USER}
2929

3030
Banner none
3131
Subsystem sftp /usr/lib/ssh/sftp-server

docker/root/usr/bin/entrypoint

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
if [ "${USER}" != "git" ]; then
44
# rename user
55
sed -i -e "s/^git\:/${USER}\:/g" /etc/passwd
6-
# switch sshd config to different user
7-
sed -i -e "s/AllowUsers git$/AllowUsers ${USER}/g" /etc/ssh/sshd_config
86
fi
97

108
if [ -z "${USER_GID}" ]; then

0 commit comments

Comments
 (0)