root パスワードをリセットする2021/07/20 |
|
root パスワードを忘れてしまった場合は以下のようにしてリセット可能です。
(GRUB ブートローダーにパスワードがセットされていない場合に有効な手段) |
|
| [1] | システムを再起動し、GRUB2 のメニュー画面が表示されたら [e] キーを押下します。 その後は以下のように進めることで root パスワードを再設定することができます。 |
# [e] キーを押下する
Rocky Linux (4.18.0-305.3.1.el8_4.x86_64) 8.4 (Green Obsidian)
Rocky Linux (0-rescue-98bc67d7659a4dd185060002cd4cc38a) 8.4 (Green Obsid>
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 gfx_payload=keep
insmod gzio
linux ($root)/vmlinuz-4.18.0-305.3.1.el8_4.x86_64 root=/dev/mapper/rl-root ro \
crashkernel=auto resume=/dev/mapper/rl-swap rd.lvm.lv=rl/root rd.lvm.lv=rl/swa\
p console=ttyS0,115200n8 rw init=/bin/bash
initrd ($root)/initramfs-4.18.0-305.3.1.el8_4.x86_64.img $tuned_initrd
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 Load Kernel Modules.
[ OK ] Stopped target Swap.
[ OK ] Started Cleaning Up and Shutting Down Daemons.
[ OK ] Stopped udev Kernel Device Manager.
[ OK ] Stopped Create Static Device Nodes in /dev.
[ OK ] Stopped Create list of required sta…vice nodes for the current kernel.
[ OK ] Stopped dracut pre-udev hook.
[ OK ] Stopped dracut cmdline hook.
[ OK ] Closed udev Kernel Socket.
[ OK ] Closed udev Control Socket.
Starting Cleanup udevd DB...
# initramfs switch_root プロンプト表示後、以下のように対応
bash-4.4#
# SELinux 有効の場合は、次回起動時 SELinux リラべリングを実行するよう設定 bash-4.4# touch /.autorelabel
# パスワード設定 bash-4.4# passwd Changing password for user root. New password: Retype new password: passwd: all authentication tokens updated successfully. # 再起動して完了 bash-4.4# exec /sbin/init
|
| Sponsored Link |
|
|