diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/common-utils/devcontainer-feature.json | 2 | ||||
-rw-r--r-- | src/common-utils/main.sh | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/common-utils/devcontainer-feature.json b/src/common-utils/devcontainer-feature.json index aadc1bc..a924aa7 100644 --- a/src/common-utils/devcontainer-feature.json +++ b/src/common-utils/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "common-utils", - "version": "2.0.10", + "version": "2.0.11", "name": "Common Utilities", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/common-utils", "description": "Installs a set of common command line utilities, Oh My Zsh!, and sets up a non-root user.", diff --git a/src/common-utils/main.sh b/src/common-utils/main.sh index 144478e..6d5ac07 100644 --- a/src/common-utils/main.sh +++ b/src/common-utils/main.sh @@ -437,6 +437,14 @@ if [ "${INSTALL_ZSH}" = "true" ]; then fi if [ "${CONFIGURE_ZSH_AS_DEFAULT_SHELL}" == "true" ]; then + # Fixing chsh always asking for a password on alpine linux + # ref: https://askubuntu.com/questions/812420/chsh-always-asking-a-password-and-get-pam-authentication-failure. + if [ ! -f "/etc/pam.d/chsh" ] || ! grep -Eq '^auth(.*)pam_rootok\.so$' /etc/pam.d/chsh; then + echo "auth sufficient pam_rootok.so" >> /etc/pam.d/chsh + elif [[ -n "$(awk '/^auth(.*)pam_rootok\.so$/ && !/^auth[[:blank:]]+sufficient[[:blank:]]+pam_rootok\.so$/' /etc/pam.d/chsh)" ]]; then + awk '/^auth(.*)pam_rootok\.so$/ { $2 = "sufficient" } { print }' /etc/pam.d/chsh > /tmp/chsh.tmp && mv /tmp/chsh.tmp /etc/pam.d/chsh + fi + chsh --shell /bin/zsh ${USERNAME} fi |