fnos: 将密码应用到 root 账户

fixes https://github.com/bin456789/reinstall/issues/256#issuecomment-2682476928
This commit is contained in:
bin456789 2025-03-02 21:57:06 +08:00
parent a12718e49c
commit bed4294644
No known key found for this signature in database
GPG Key ID: EE301B386DE6C11B
2 changed files with 11 additions and 4 deletions

View File

@ -3794,7 +3794,7 @@ fi
# 密码
if ! is_netboot_xyz && [ -z "$password" ]; then
if is_use_dd || [ "$distro" = fnos ]; then
if is_use_dd; then
echo "
This password is only used for SSH access to view logs during the installation.
Password of the image will NOT modify.
@ -4249,8 +4249,15 @@ elif is_alpine_live; then
elif is_use_dd; then
echo 'Reboot to start DD.'
elif [ "$distro" = fnos ]; then
echo "Special note for FNOS:"
echo "Reboot to start the installation."
echo "After install, you need to config the system on http://SERVER_IP:5666 as soon as possible."
echo "SSH login is disabled when installation completed."
echo "You need to config the account and password on http://SERVER_IP:5666 as soon as possible."
echo
echo "飞牛 OS 注意事项:"
echo "重启后开始安装。"
echo "安装完成后不支持 SSH 登录。"
echo "你需要尽快在 http://SERVER_IP:5666 配置账号密码。"
else
echo "Reboot to start the installation."
fi

View File

@ -3920,12 +3920,12 @@ install_fnos() {
# 更新 initrd
# chroot $os_dir update-initramfs -u
# 删除自带的 root 密码
# 更改密码
# chroot $os_dir passwd -d root
echo "root:$(get_password_linux_sha512)" | chroot $os_dir chpasswd -e
# ssh root 登录,测试用
if false; then
echo "root:$(get_password_linux_sha512)" | chroot $os_dir chpasswd -e
allow_root_password_login $os_dir
chroot $os_dir systemctl enable ssh
fi