Category Archives: unix

FreeBSD – Reset password

Three steps to change root password in FreeBSD:

Step 1: Boot in single user mode

As the operating system is starting, it will display the following message:
Hit [Enter] to boot immediately, or any other key for command prompt.
Booting [kernel] in 10 seconds…
You should now press the space bar, and you will see the following message:
Type ‘?’ for a list of commands, or ‘help’ for more detailed help.
# boot -s
to start FreeBSD in single user mode. After the system boots, you should see the statement:
Enter full pathname of shell or RETURN for /bin/sh:
Press the enter key and you will have a # prompt.

Step 2: Mount the filesystems

At the command prompt, issue the mount command. This command will mount all the filesystems listed in your /etc/fstab file.
# mount -t ufs -a

Step 3: Change the root password

Issue the passwd command and you will be prompted to enter a new password for the root account.

# passwd

New password:_
Retype new password:_
passwd: updating the database…
passwd: done

# exit


Unix directory

Lest’s have a look inside the unix directory structure.

Directory Description
bin Essential command binaries
boot Static files of the boot loader
dev Device files
etc Host-specific system configuration
lib Essential shared libraries and kernel modules
media Mount point for removeable media
mnt Mount point for mounting a filesystem temporarily
opt Add-on application software packages
sbin Essential system binaries
srv Data for services provided by this system
tmp Temporary files
usr Secondary hierarchy
var Variable data

The above is the main folder structure, but there are some of those folders that we should check in deep.

/dev/null This virtual folder discards all contents written to it.
/usr/bin Stores the executables that are in /usr.
/usr/lib Required libraries are stored here
/var/log System log files
/var/mail All incoming emails are stored
/var/spool files in which printers are involved as spools, print jobs or other task that have been queued.