Would you regard it as OK to build a back door into your own programs?

Say its a prog that requires users to have passwords and that holds personnel records. Assuming the developer's intentions are good and they would not use the back door for the powers of evil, is it acceptable practice? Such a back door would only be used in emergencies where everyone has lost their passwords or the system is collapsing, it may for example dump the entire DB contents to an unencrypted file. Is this even legal?

What do you think?