Skip to content

Eternal Center

  • System (系统)
  • Services (服务)
  • Databases (数据库)
  • Clusters (集群)
  • Big Data (大数据)
  • Cloud Computing (云计算)
  • Languages (语言)
  • Project (项目)
  • Writings (写作)
  • Eternity (永恒)
  • News (消息)
  • Chronicle (编年史)
  • Words (言)
Posted on February 22, 2021January 25, 2022 by Mingyu Zhu

[工具] Shell 自动化部署 GRUB2 Bootloader 密码 (openSUSE & SLE 版)

介绍:

作者:朱明宇
名称:自动化部署 GRUB2 Bootloader 密码(openSUSE & SLE 版)
作用:自动化部署 GRUB2 Bootloader 密码(openSUSE & SLE 版)

使用方法:
1. 给此脚本添加执行权限
2. 执行此脚本
3. 当启动系统时,左下角出现以下内容时按下 “E”:
C: Command Line    E: Edit Entry

注意:
1. 登陆的账号是 root
2. 登陆的密码是 eternalcenter

脚本:

#!/bin/bash

echo "#!/bin/sh
exec tail -n +3 \$0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
set superusers=\"root\"
password_pbkdf2 root grub.pbkdf2.sha512.10000.B857B79D02FF55CA3A69B8485C1A4A427424630C804CC8A89134520A34E056D7882A778F6BC8AD856CB95DF8B99BE25F9FEAD899D826BB3915FB20BAD682D10A.4A1CF49B7F815A0578031CCA2CE98C66BDFBEAB0AE2721531BB54AFC6CFFA990FBD9062F41C006376C283B717FEC1BD9BB1AFB882AF91B5F4A812459D7974D1F
export superusers
set unrestricted_menu=\"y\"
export unrestricted_menu" > /etc/grub.d/40_custom

grep "rd.shell=0" /etc/default/grub
if [ $? -ne 0 ];then
        sed -i '/GRUB_CMDLINE_LINUX_DEFAULT="/s/"$/ rd.shell=0"/' /etc/default/grub
fi

grep "showopts" /etc/default/grub
if [ $? -ne 0 ];then
        sed -i '/GRUB_CMDLINE_LINUX_DEFAULT="/s/"$/ showopts"/' /etc/default/grub
fi

grep "LANG=C" /etc/default/grub
if [ $? -ne 0 ];then
        sed -i '/GRUB_CMDLINE_LINUX_DEFAULT="/s/"$/ LANG=C"/' /etc/default/grub
fi

grub2-mkconfig -o /boot/grub2/grub.cfg
CategoriesChinese (中文), Languages (语言), Shell, Shell Deployment (部署), Shell Others (其他), Shell Tool (工具), System (系统), System Login Security (系统登录安全), System Network & System Security & System Log (系统网络 & 系统安全 & 系统日志), System Security (系统安全)

Post navigation

Previous PostPrevious [实验] 通过 Nginx + Keepalived 实现网站负载均衡加高可用
Next PostNext [命令] Linux 命令 rm (删除目录或文件)

Aspiration (愿景):

Everyone can achieve self achievement and self happiness fairly

每个人都能公平地实现自我成就和自我幸福

Position (位置):

Running on Evolution Host and DigitalOcean

正在 Evolution Host 和 DigitalOcean 上运行

Logo (徽标):

Additional Information (其他信息):

About Manual Clone Contact Disclaimer Donation Friendly Links 关于 说明书 克隆 联系 免责申明 捐赠 友情链接

Standby IP Address (备用 IP 地址):

152.69.204.95  150.230.63.10  Please configure before use / 请先配置再使用

Search Outside Website (站外搜索):

Google Wikipedia Bing
Proudly powered by LNMP Proudly powered by WordPress