If you've installed Slackware and forgotten the root password, it's easy to reset. In fact, passwords on any OS are easy to reset as long as you have physical access to the computer and install media. Slackware is no exception.
This also will be an introduction to the concept of chroot
, which is a great command and concept to understand, so whether or not you actually need to reset a password just this moment, you might find this post informative.
Here is how to reset a forgotten root password:
At this point, you're sitting in the normal shell for the Slackware installer. Here is where the terminology gets strange; you are here to reset the root password, but remember that the beginning point of a UNIX filesystem is also called “root”. It is a completely different concept from being a “root user”. So remember that there is the root location and a root user, and we're talking about both of those things here. I will be very explicit as to which “root” concept I am talking about from this point on.
Right now, your computer thinks the root [the location] point of your hard drive is the DVD drive because you booted from the DVD. It makes sense that the computer sees that as its root location.
What you need to do is re-assign what the computer sees as its root [the location] partition so that any commands you give it applies to a new root [the location]. That is, you want to take the computer and yank the rug out from under its feet, and switch it out for the actual physical hard drive upon which you have installed Slackware-with-a-forgotten-password. And you don't want the computer to notice.
That's precisely what chroot
was written to do.
# mkdir /rescue # mount /dev/sda1 /rescue
# cd /rescue # chroot .
chroot
, has no memory that you booted off of a DVD. This means that if you run the passwd
command to change your password, instead of changing the password for the DVD environment, it will change the password for your hard drive's root [the person] user.Do that now:
# passwd
When you reboot, be sure to eject the DVD so that your computer does't boot off of it again. Once your system is up, log in as root with your new passphrase and get back to work.