zoukankan      html  css  js  c++  java
  • CentOS7 Linux中通过加密grub防止黑客通过单用户系统破解root密码

    如何防止别人恶意通过单用户系统破解root密码,进入系统窃取数据?

    grub加密,不让别人通过grub进入单用户。

    17.3.1  基于centos6进行grub加密

    [root@63 ~]# grub-md5-crypt

    Password: 123456

    Retype password: 123456

    $1$oaqo5$3d/cmTosm68jTw6o1wCu31

    [root@localhost init]# vim /boot/grub/grub.conf

    #boot=/dev/sda

    default=0

    timeout=5

    splashimage=(hd0,0)/grub/splash.xpm.gz

    hiddenmenu

    password --md5 $1$oaqo5$3d/cmTosm68jTw6o1wCu31

    title Red Hat Enterprise Linux (2.6.32-220.el6.x86_64)

            root (hd0,0)

    如图:

     

     

    重启测试:  

    编辑grub时,需要按下p键,然后输入密码:123456

     

     

     基于centos7进行grub加密

    生成密码

    [root@63 ~]# grub2-mkpasswd-pbkdf2

    输入口令: 123456

    Reenter password:  123456

    PBKDF2 hash of your password is grub.pbkdf2.sha512.10000.8F355BAB512AFB7B8C990A1FEB887B8F2F3F1C54467E9B9F0535F2268E1FFC5F4E8D33F7633D7FBEC25B2039C6D8B3226A90528D4883AB9B99E391A4965D069F.DDE992693BE2C09FFEEC1149120B6B84DBAB933DE6CF7BFF718E1DDC858AB73EE32CFF45EB7F06AC45AA6792E91C4CD09E2B445FC288C47E79F537DBBABAD756

     

    [root@63 ~]# vim /etc/grub.d/00_header    #在最后后面添加如下内容,注mk这个用户名可以换成自己的用户名

    cat <<EOF

    set superusers='richqige'

    password_pbkdf2  richqige grub.pbkdf2.sha512.10000.8F355BAB512AFB7B8C990A1FEB887B8F2F3F1C54467E9B9F0535F2268E1FFC5F4E8D33F7633D7FBEC25B2039C6D8B3226A90528D4883AB9B99E391A4965D069F.DDE992693BE2C09FFEEC1149120B6B84DBAB933DE6CF7BFF718E1DDC858AB73EE32CFF45EB7F06AC45AA6792E91C4CD09E2B445FC288C47E79F537DBBABAD756

    EOF

     

    [root@richqige63 ~]# grub2-mkconfig -o /boot/grub2/grub.cfg  #更新grub信息

    重启验证:

     

    输入用户名和密码

     

    看到可以进入GRUB菜单,就证明你加密成功了

     

    ctrl-x 开始启动

  • 相关阅读:
    RDD的基本命令
    python 数据类型
    RDD基础
    sql优化
    python文件操作
    Python之xlsx文件与csv文件相互转换
    ValueError: Some of types cannot be determined by the first 100 rows, please try again with sampling
    python
    python操作dataFrame
    python 列表,元祖,字典
  • 原文地址:https://www.cnblogs.com/fusheng11711/p/10769933.html
Copyright © 2011-2022 走看看