Passwords provide a layer of protection for the switch to prevent unauthorized use.
Catalyst switches have basically two levels of password protection (user level and privileged level).
Privileged passwords are encrypted for tighter security.
If a password is lost, each OS offers a password recovery process to gain access to the device.
(Optional; highly recommended) Configure a user-level password: