root パスワードをリセットする2022/06/29 |
|
root パスワードを忘れてしまった場合は以下のようにしてリセット可能です。
(GRUB ブートローダーにパスワードがセットされていない場合に有効な手段) |
|
| [1] | システムを再起動し、GRUB2 のメニュー画面が表示されたら [e] キーを押下します。 その後は以下のように進めることで root パスワードを再設定することができます。 |
# [e] キーを押下する
CentOS Stream (5.14.0-115.el9.x86_64) 9
CentOS Stream (5.14.0-105.el9.x86_64) 9
CentOS Stream (5.14.0-86.el9.x86_64) 9
CentOS Stream (0-rescue-ab414d4792d04b9dbc1e2361f936e849) 9
Use the ^ and v keys to change the selection.
Press 'e' to edit the selected item, or 'c' for a command prompt.
# 以下のように [linux] 行の行末に [rw init=/bin/bash] と追記する
load_video
set gfxpayload=keep
insmod gzio
linux ($root)/vmlinuz-5.14.0-115.el9.x86_64 root=/dev/mapper/cs-root ro crashk\
ernel=1G-4G:192M,4G-64G:256M,64G-:512M resume=/dev/mapper/cs-swap rd.lvm.lv=cs\
/root rd.lvm.lv=cs/swap console=ttyS0,115200n8 rw init=/bin/bash
initrd ($root)/initramfs-5.14.0-115.el9.x86_64.img
Press Ctrl-x to start, Ctrl-c for a command prompt or Escape to
discard edits and return to the menu. Pressing Tab lists
possible completions.
# 以上のように入力後、[Ctrl-x] キーを押下する
.....
.....
[ OK ] Stopped Rule-based Manager for Device Events and Files.
[ OK ] Closed udev Control Socket.
[ OK ] Closed udev Kernel Socket.
[ OK ] Stopped dracut pre-udev hook.
[ OK ] Stopped dracut cmdline hook.
Starting Cleanup udev Database...
[ OK ] Stopped Create Static Device Nodes in /dev.
[ OK ] Stopped Create List of Static Device Nodes.
[ OK ] Finished Plymouth switch root service.
# プロンプト表示後、以下のように対応
bash-5.1#
# SELinux 有効の場合は、次回起動時 SELinux リラべリングを実行するよう設定 bash-5.1# touch /.autorelabel
# パスワード設定 bash-5.1# passwd Changing password for user root. New password: Retype new password: passwd: all authentication tokens updated successfully. # 再起動して完了 bash-5.1# exec /sbin/init
|
| Sponsored Link |
|
|