单用户模式 - 密码恢复
使用单用户模式协助排除系统启动问题或进行密码恢复。
要进入单用户模式
启动交换机,然后在看到 GRUB 菜单后,使用箭头键选择 Cumulus Linux GNU/Linux 高级选项。
在 GRUB 菜单出现之前,交换机将经历启动周期。当您看到以下行时,不要中断此自动启动过程;等待直到您看到 GRUB 菜单。
... USB0: Bringing USB2 host out of reset... Net: eth-0 SF: MX25L6405D with page size 4 KiB, total 8 MiB Hit any key to stop autoboot: 2
GNU GRUB version 2.02+dfsg1-20 +----------------------------------------------------------------------------+ |*Cumulus Linux GNU/Linux | | Advanced options for Cumulus Linux GNU/Linux | | ONIE | | | +----------------------------------------------------------------------------+
选择 Cumulus Linux GNU/Linux,使用 Linux 4.19.0-cl-1-amd64 (恢复模式)。
GNU GRUB version 2.02+dfsg1-20 +----------------------------------------------------------------------------+ | Cumulus Linux GNU/Linux, with Linux 4.19.0-cl-1-amd64 | |*Cumulus Linux GNU/Linux, with Linux 4.19.0-cl-1-amd64 (recovery mode) | | | +----------------------------------------------------------------------------+
系统重启后,设置新的 root 密码。root 用户提供对交换机的完全控制。
root@switch:~# passwd Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully
您可以借此机会重置 cumulus 帐户的密码。
root@switch:~# passwd cumulus Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully
在 Cumulus Linux 5.9 及更高版本中,用户密码必须至少包含一个小写字符、一个大写字符、一个数字、一个特殊字符,并且不能是用户名。此外,密码必须至少为八个字符长,在 365 天后过期,并在过期前 15 天提供警告。有关密码安全策略的更多信息,请参阅 密码安全。
同步
/etc
目录,然后重启系统root@switch:~# sync root@switch:~# reboot -f Restarting the system.