diff --git a/root/etc/cont-init.d/50-config b/root/etc/cont-init.d/50-config index 3c409d0..ddf77c8 100644 --- a/root/etc/cont-init.d/50-config +++ b/root/etc/cont-init.d/50-config @@ -10,7 +10,7 @@ echo "User name is set to $USER_NAME" # set password for abc to unlock it and set sudo access sed -i "/${USER_NAME} ALL.*/d" /etc/sudoers if [ "$SUDO_ACCESS" == "true" ]; then - if [ -n "$USER_PASSWORD" ] || [ -n "$USER_PASSWORD_FILE" -a -f "$USER_PASSWORD_FILE" ]; then + if [ -n "$USER_PASSWORD" ] || [ -n "$USER_PASSWORD_FILE" ] && [ -f "$USER_PASSWORD_FILE" ]; then echo "${USER_NAME} ALL=(ALL) ALL" >> /etc/sudoers echo "Sudo is enabled with password." else @@ -23,7 +23,7 @@ fi [[ -n "$USER_PASSWORD_FILE" ]] && [[ -f "$USER_PASSWORD_FILE" ]] && \ USER_PASSWORD=$(cat "$USER_PASSWORD_FILE") && \ echo "User password is retrieved from file." -USER_PASSWORD=${USER_PASSWORD:-$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-8};echo;)} +USER_PASSWORD=${USER_PASSWORD:-$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c"${1:-8}";echo;)} echo "${USER_NAME}:${USER_PASSWORD}" | chpasswd # symlink out ssh config directory @@ -61,12 +61,12 @@ if [ ! -f /config/.ssh/authorized_keys ];then fi [[ -n "$PUBLIC_KEY" ]] && \ - [[ ! $(grep "$PUBLIC_KEY" /config/.ssh/authorized_keys) ]] && \ + [[ ! $(grep "${PUBLIC_KEY}" /config/.ssh/authorized_keys) ]] && \ echo "$PUBLIC_KEY" >> /config/.ssh/authorized_keys && \ echo "Public key from env variable added" [[ -n "$PUBLIC_KEY_URL" ]] && \ - PUBLIC_KEY_DOWNLOADED=$(curl -s $PUBLIC_KEY_URL) && \ + PUBLIC_KEY_DOWNLOADED=$(curl -s "$PUBLIC_KEY_URL") && \ [[ ! $(grep "$PUBLIC_KEY_DOWNLOADED" /config/.ssh/authorized_keys) ]] && \ echo "$PUBLIC_KEY_DOWNLOADED" >> /config/.ssh/authorized_keys && \ echo "Public key downloaded from '$PUBLIC_KEY_URL' added" diff --git a/root/etc/services.d/openssh-server/log/run b/root/etc/services.d/openssh-server/log/run index f8ddf63..e4de12c 100644 --- a/root/etc/services.d/openssh-server/log/run +++ b/root/etc/services.d/openssh-server/log/run @@ -3,4 +3,4 @@ USER_NAME=${USER_NAME:-linuxserver.io} exec \ - s6-setuidgid ${USER_NAME} s6-log n30 s10000000 S30000000 T !"gzip -nq9" /config/logs/openssh \ No newline at end of file + s6-setuidgid "${USER_NAME}" s6-log n30 s10000000 S30000000 T !"gzip -nq9" /config/logs/openssh \ No newline at end of file diff --git a/root/etc/services.d/openssh-server/run b/root/etc/services.d/openssh-server/run index c7e6d97..141c03d 100644 --- a/root/etc/services.d/openssh-server/run +++ b/root/etc/services.d/openssh-server/run @@ -3,4 +3,4 @@ USER_NAME=${USER_NAME:-linuxserver.io} exec 2>&1 \ - s6-setuidgid ${USER_NAME} /usr/sbin/sshd.pam -D -e -p 2222 + s6-setuidgid "${USER_NAME}" /usr/sbin/sshd.pam -D -e -p 2222