mirror of
https://github.com/bin456789/reinstall.git
synced 2025-01-31 10:58:06 +08:00
el: 删除国产系统镜像的默认账户,防止使用默认账户密码登录 ssh
This commit is contained in:
parent
6fd3f18b54
commit
fc12aa67ab
14
trans.sh
14
trans.sh
@ -2239,6 +2239,17 @@ chroot_apt_autoremove() {
|
|||||||
mv $conf.orig $conf
|
mv $conf.orig $conf
|
||||||
}
|
}
|
||||||
|
|
||||||
|
del_default_user() {
|
||||||
|
os_dir=$1
|
||||||
|
|
||||||
|
while read -r user; do
|
||||||
|
if grep ^$user':\$' "$os_dir/etc/shadow"; then
|
||||||
|
echo "Deleting user $user"
|
||||||
|
chroot "$os_dir" userdel -rf "$user"
|
||||||
|
fi
|
||||||
|
done < <(grep -v nologin$ "$os_dir/etc/passwd" | cut -d: -f1 | grep -v root)
|
||||||
|
}
|
||||||
|
|
||||||
install_qcow_by_copy() {
|
install_qcow_by_copy() {
|
||||||
mount_nouuid() {
|
mount_nouuid() {
|
||||||
case "$(get_os_fs)" in
|
case "$(get_os_fs)" in
|
||||||
@ -2384,6 +2395,9 @@ install_qcow_by_copy() {
|
|||||||
# resolv.conf
|
# resolv.conf
|
||||||
cp_resolv_conf /os
|
cp_resolv_conf /os
|
||||||
|
|
||||||
|
# 删除镜像的默认账户,防止使用默认账户密码登录 ssh
|
||||||
|
del_default_user /os
|
||||||
|
|
||||||
# selinux kdump
|
# selinux kdump
|
||||||
disable_selinux_kdump /os
|
disable_selinux_kdump /os
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user