Cart

    Sorry, we could not find any results for your search querry.

    Resetting your (Free)BSD root password

    It can happen that over time you forget the root password for your (Free)BSD installation, but fortunately there is a solution. In this article we will show you how to reset your root password on BSD releases such as FreeBSD and pfSense. 

    Do you still have your root password but have lost another user’s password? Then use the following command as the root user to change the password:

    passwd username

     

    Step 1

    To reset your root password, switch to your VPS’s 'FreeBSD rescue mode'. In the TransIP Control Panel, go to the VPS whose password you want to reset and click the console pop-out icon in the bottom left.


     

    Step 2

    Select 'Options' > 'Boot Linux rescue mode'.


     

    Step 3

    You will now automatically enter FreeBSD rescue mode. You need the name of the partition. To find it, first list the available disks:

    sysctl kern.disks

    The output will look something like this:

    kern.disks: vtbd0

    vtbd0 is the disk’s name. Next, find the partition with:

    gpart show -p vtbd0

    The last line shows the partition name, usually vtbd0s1:

    =>      63  209715137    vtbd0  MBR  (100G)
            63          1           - free -  (512B)
            64  209715136  vtbd0s1  freebsd  [active]  (100G)

     

    Step 4

    Now mount your partition:

    mount -t ufs -o rw /dev/vtbd0s1 /mnt
    

    You will see a warning ‘/ was not properly dismounted’. You can ignore this: it simply means the filesystem journal hasn’t been replayed. Optionally, run a filesystem check first with ‘fsck -y’.


     

    Step 5

    Now reset your root password with the following commands: 

    pw -R /mnt usermod root -h 0
    pwd_mkdb -d /mnt/etc -p /mnt/etc/master.passwd

    The first command resets the root password; the second rebuilds the password database.


     

    Step 6

    Then unmount your filesystem:

    umount /mnt

     

    Step 9

    Finally, reboot your VPS. Click ‘Reboot’ at the top of the VPS console pop-out window, or close the pop-out and click ‘reset’ beneath the VPS console in the TransIP Control Panel for a hard reset. You will then reach the normal login screen and can sign in with your new root password.

     

    Need help?

    Receive personal support from our supporters

    Contact us