Practical UNIX and Internet Security, 3rd Edition
by Simson Garfinkel, Gene Spafford, Alan Schwartz
Tips on Using Passwords
Lots of computer programs use passwords for user authentication. Beyond the standard Unix password, users soon find that they have passwords for special electronic mail accounts, special accounting programs, and even fantasy role-playing games.
Few users are good at memorizing passwords, and there is a great temptation to use a single password for all uses. This is a bad idea. Users should be encouraged not to type their login password into some MUD that’s running over at the local university, for example.
As a programmer, there are several steps that you can take in programs that ask for passwords to make the process more secure:
Don’t echo the password as the user types it. Normally, Unix turns off echo when people type passwords. You can do this yourself by using the getpass( ) function. In recent years, however, a trend has evolved to echo asterisks (*) for each character of the password typed. This provides some help for the person typing the password to see if they have made a mistake in their typing, but it also enables somebody looking over the user’s shoulders to see how many characters are in the password.
When you store the user’s password on the computer, concatenate a key and a salt, and encrypt the password with a cryptographically secure one-way function. Never have programs store passwords in plaintext form in files or databases. If this file is compromised, all of the passwords need to be changed!
Traditionally, the easy way to store a password ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access