From 5ef6f876e736881ffe04628f4219a91f8c5d97df Mon Sep 17 00:00:00 2001 From: mini2024 Date: Thu, 13 Mar 2025 01:16:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BA=20Alpine=20=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20bash=20=E9=BB=98=E8=AE=A4=20shell=20?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E5=8A=9F=E8=83=BD=EF=BC=8C=E5=AE=89=E8=A3=85?= =?UTF-8?q?=20shadow=20=E5=8C=85=E4=BB=A5=E6=94=AF=E6=8C=81=E6=9B=B4?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 1.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/1.sh b/1.sh index dfe379e..6452d4b 100644 --- a/1.sh +++ b/1.sh @@ -20,7 +20,10 @@ if [ -f /etc/debian_version ]; then chsh -s $(which bash) print_green "已将 bash 设置为默认 shell" elif [ -f /etc/alpine-release ]; then - sed -i 's/^root:.*/root:\/bin\/bash/' /etc/passwd + apk add shadow + chsh -s $(which bash) root + # sed -i 's|^\(root:.*\):[^:]*$|\1:/bin/bash|' /etc/passwd + # sed -i 's|^\(root:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*\):[^:]*$|\1:/bin/bash|' /etc/passwd print_yellow "已将 bash 设置为默认 shell" fi