大网数据广告活动
服务器运维问答

Change root password with old Linux 2.4.20

· 52CE 我爱测

I have an old (Linux 2.4.20) Debian server where I forgot the root password. When I try to enter single user mode then some init script never exits. It used the LILO boot loader. I want to change the root password and therefore I…

问题原文

原帖链接 · Niklas Rosencrantz · CC BY-SA 3.0

I have an old (Linux 2.4.20) Debian server where I forgot the root password. When I try to enter single user mode then some init script never exits. It used the LILO boot loader. I want to change the root password and therefore I tried booting to single user mode. But when I try and boot to single user mode the system won't boot all the way. It stops when trying to run a custom init shell script. It says executing....

Can you please advice me what I can do? I want to change to root password in single user mode but now I don't dare to reboot it because Crtl+Alt+Delete doesn't work for reboot during boot.

已采纳解答

原帖链接 · Marco · CC BY-SA 3.0

I'd boot via a live distro such as Debian Live or Knoppix, ensure you have access to local drives, gain root privilege using su - or sudo -s, depending on distro.

Mount the / partition and change root's password this way:

mkdir /mnt/youroot
mount /dev/youroot /mnt/youroot
chroot /mnt/youroot /bin/bash
passwd root
exit 
umount /mnt/youroot

Reboot (remove live distro from cd/usb).

And that's it!

Edit #1: After your edit I'm assuming that you are using a remote KVM, and you can't just walk at the server and pull the cable, and so you have very few options. I'd just try Crtl+Alt+F2 (3,4,...12), Crtl+C, Crtl+Z, to check if I can get a prompt.

Check out the user manual for the KVM you are using because you should probably be able to issue a soft/hard reboot right from the remote console.

If you are still stuck at boot and can't reboot in any way you'll have to ask your hosting/provider to issue an hard reboot.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-07-11)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。