为 Alpine 系统添加 bash 默认 shell 设置功能,安装 shadow 包以支持更改
This commit is contained in:
5
1.sh
5
1.sh
@ -20,7 +20,10 @@ if [ -f /etc/debian_version ]; then
|
|||||||
chsh -s $(which bash)
|
chsh -s $(which bash)
|
||||||
print_green "已将 bash 设置为默认 shell"
|
print_green "已将 bash 设置为默认 shell"
|
||||||
elif [ -f /etc/alpine-release ]; then
|
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"
|
print_yellow "已将 bash 设置为默认 shell"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user