当忘记Console密码时候,想要不丢配置可以将设备重启,进行以下操作更改密码。

    1、设备重启之后,看到按“CTRL+B”的提示时,快速按CTRL+B。 #手速跟不上可重启后狂按CTRL+B

    注:有的设备按下CTRL+B后,需要再按一下回车键,才能显示BootROM的菜单选项

    方法一:选择BootROM菜单选项<8> Skip Authentication for Console Login
    2、 下面就是BootROM的菜单项,选择8,回车
    注:6和8都可以跳过Console密码,效果是不同的,有的设备是没有第8个选项,根据自己的设备情况来

    1. ==========================<EXTENDED-BOOTWARE MENU>==========================
    2. |<1> Boot System #启动应用程序,也就是直接进入系统
    3. |<2> Enter Serial SubMenu #进入串口子菜单,用来更改串口速率和上传文件
    4. |<3> Enter Ethernet SubMenu #进入以太网子菜单,一般用网线上传文件从这里设置
    5. |<4> File Control #进入文件控制器子菜单,是对文件的一些基本操作:查看、删除等
    6. |<5> Restore to Factory Default Configuration #恢复出厂设置
    7. |<6> Skip Current System Configuration #跳过当前系统配置,不启动你之前的配置,属于空配置
    8. |<7> BootWare Operation Menu #进入BootRWare操作子菜单
    9. |<8> Skip Authentication for Console Login #跳过Console口登录认证,也就是跳过console密码
    10. |<9> Storage Device Operation #进入存储介质操作子菜单
    11. |<0> Reboot #重启设备
    12. ============================================================================
    13. Ctrl+Z: Access EXTENDED ASSISTANT MENU
    14. Ctrl+F: Format File System
    15. Enter your choice(0-9):8

    3、回车后会再次回到这个界面,选择1,回车进入系统

    1. ==========================<EXTENDED-BOOTWARE MENU>==========================
    2. |<1> Boot System |
    3. |<2> Enter Serial SubMenu |
    4. |<3> Enter Ethernet SubMenu |
    5. |<4> File Control |
    6. |<5> Restore to Factory Default Configuration |
    7. |<6> Skip Current System Configuration |
    8. |<7> BootWare Operation Menu |
    9. |<8> Skip Authentication for Console Login |
    10. |<9> Storage Device Operation |
    11. |<0> Reboot |
    12. ============================================================================
    13. Ctrl+Z: Access EXTENDED ASSISTANT MENU
    14. Ctrl+F: Format File System
    15. Enter your choice(0-9):1

    4、选择的跳过console认证,进入系统后将不输入console密码,直接进入到用户视图,此刻设备的配置为空,可以在系统视图下配置回滚恢复原有配置,如下配置表示将当前配置回滚到配置文件startup.cfg中的配置状态。如果不想恢复原有配置,请跳过此步骤。

    1. <H3C> system-view
    2. [H3C]configuration replace file startup.cfg
    3. Current configuration will be lost, save current configuration? [Y/N]:n
    4. Info: Now replacing the current configuration. Please wait...
    5. Info: Succeeded in replacing current configuration with the file startup.cfg.

    5、更改console密码、保存配置

    在系统视图下设置新的Console口密码,如下配置表示设置Console口验证方式为密码验证,且以密文方式设置Console口的密码为123456。

    1. <H3C>sys
    2. [H3C]user-interface console 0 #进入console视图下
    3. [H3C-ui-console0]authentication-mode password #设置安全模式为密码
    4. [H3C-ui-console0]set authentication password simple 123456 #设置密码为123456
    5. [H3C-ui-console0] sa f #保存当前配置
    6. 此刻你的console密码就是123456,保存配置后

    方法二:选择BootROM菜单选项<6> Skip Current System Configuration
    2、 下面就是BootROM的菜单项,选择6,回车

    注:<6>选项进入系统后,是跳过当前配置,所以里面是空配置,但原配置还在系统中

    1. ==========================<EXTENDED-BOOTWARE MENU>==========================
    2. |<1> Boot System #启动应用程序,也就是直接进入系统
    3. |<2> Enter Serial SubMenu #进入串口子菜单,用来更改串口速率和上传文件
    4. |<3> Enter Ethernet SubMenu #进入以太网子菜单,一般用网线上传文件从这里设置
    5. |<4> File Control #进入文件控制器子菜单,是对文件的一些基本操作:查看、删除等
    6. |<5> Restore to Factory Default Configuration #恢复出厂设置
    7. |<6> Skip Current System Configuration #跳过当前系统配置,不启动你之前的配置,属于空配置
    8. |<7> BootWare Operation Menu #进入BootRWare操作子菜单
    9. |<8> Skip Authentication for Console Login #跳过Console口登录认证,也就是跳过console密码
    10. |<9> Storage Device Operation #进入存储介质操作子菜单
    11. |<0> Reboot #重启设备
    12. ============================================================================
    13. Ctrl+Z: Access EXTENDED ASSISTANT MENU
    14. Ctrl+F: Format File System
    15. Enter your choice(0-9):6
    1. ==========================<EXTENDED-BOOTWARE MENU>==========================
    2. |<1> Boot System |
    3. |<2> Enter Serial SubMenu |
    4. |<3> Enter Ethernet SubMenu |
    5. |<4> File Control |
    6. |<5> Restore to Factory Default Configuration |
    7. |<6> Skip Current System Configuration |
    8. |<7> BootWare Operation Menu |
    9. |<8> Skip Authentication for Console Login |
    10. |<9> Storage Device Operation |
    11. |<0> Reboot |
    12. ============================================================================
    13. Ctrl+Z: Access EXTENDED ASSISTANT MENU
    14. Ctrl+F: Format File System
    15. Enter your choice(0-9):1

    3、回车后会再次回到这个界面,选择1,回车进入系统
    4、进入系统后,无需输入console密码,直接进入到用户视图

    1. <H3C>dir #查看系统文件
    2. Directory of flash:
    3. 0 drw- - Sep 16 2020 10:13:44 diagfile
    4. 1 -rw- 1554 Sep 16 2020 11:13:01 ifindex.dat
    5. 2 -rw- 21632 Sep 16 2020 10:13:44 licbackup
    6. 3 drw- - Sep 16 2020 10:13:44 license
    7. 4 -rw- 21632 Sep 16 2020 10:13:44 licnormal
    8. 5 drw- - Sep 16 2020 10:13:44 logfile
    9. 6 -rw- 0 Sep 16 2020 10:13:43 s5820v2_5830v2-cmw710-boot-a7514.bin
    10. 7 -rw- 0 Sep 16 2020 10:13:43 s5820v2_5830v2-cmw710-system-a7514.bin
    11. 8 drw- - Sep 16 2020 10:13:44 seclog
    12. 9 -rw- 6382 Sep 16 2020 11:13:01 startup.cfg
    13. 10 -rw- 111206 Sep 16 2020 11:13:01 startup.mdb
    14. 1046512 KB total (1046304 KB free)

    注:配置文件默认名称为 startup.cfg,配置文件都是 .cfg结尾
    5、查看配置文件

    1. <H3C>more startup.cfg #查看startup.cfg文件
    2. #
    3. version 7.1.075, Alpha 7571
    4. #
    5. sysname H3C
    6. #
    7. irf mac-address persistent timer
    8. irf auto-update enable
    9. undo irf link-delay
    10. irf member 1 priority 1
    11. #
    12. lldp global enable
    13. #

    一下空格敲到底,将配置文件拷贝出来
    找到 line con 0
    将里面的set authentication password hash 以及后面的一堆数字字母符号的东西删掉,替换成 set authentication password simple 123456 #意思就是将密码设置成123456
    6、将刚才拷贝出来并改好密码的配置,复制粘贴再刷到配置中
    最重要的一步
    save force 保存配置
    [

    ](https://blog.csdn.net/Enoch_Liu/article/details/108617139)