If you forgot your root password, you can simply reset it. The general procedure for resetting password is as follows (if you are a Linux user, see how to reset Linux root password):
a) At boot> prompt force openbsd to boot into a single user mode
b) Next mount file system in read-write mode
c) Run passwd command
d) Sync file system
e) Reboot and login normally.
Procedure to reset root password
At boot> prompt type boot -s to boot into single user mode:
boot> boot -s
Next you will see a message as follows:
Enter pathname of shell or RETURN for sh:
Just hit [Enter] key to load sh shell.
Next mount / and /usr file system in read-write mode:
# mount -uw /
# mount /usr
Finally set or change the password for root user, enter:
# passwd
Press CTRL+D to boot into multiuser mode or just reboot server:
# reboot
Further reading
- Howto: Recovering grub boot loader password
- Recovering deleted /etc/shadow password file
- 10 boot time parameters you should know about the Linux kernel
- Debian Linux – Grub Boot into single user mode
- Read boot man page
🐧 Get the latest tutorials on Linux, Open Source & DevOps via:
- RSS feed or Weekly email newsletter
- Share on Twitter • Facebook • 1 comment... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
The problem is that this method doesn’t work for many modern distros (like PC-BSD and openSUSE). They ask you for root password at boot time. In BSD, it is controlled, IIRC, by setting ‘secure’ in the /etc/ttys file for the tty. Not really sure how it is done in Linux. In openSUSE, there is a /etc/inittab file, and in there is a ‘what to do in single-user mode” comment that includes running /sbin/sulogin. Perhaps if this is commented out?
Another discussion is here:
http://linux.about.com/od/linux101/l/blnewbie3_2_3.htm
This is how you can boot a Live CD and edit the /etc/shadow file to remove the root password.