Best way to store a database password in a startup script / config file?

passwords, security, sql-server

Solution

The best way to secure your password is to stop using one. Use a trusted connection: How To: Connect to SQL Server Using Windows Authentication in ASP.NET 2.0. Then you have nothing to hide - publish your web.config and source to the world, they still can't hit your database.

If that won't work for you, use the built in configuration encryption system in ASP.NET.

Problem

So our web server apps need to connect to the database, and some other apps have startup scripts that execute at boot time. What's the best way to store the name/password for these applications, in terms of - security, e.g. perhaps we don't want sysadmins to know the database password - maintainability, e.g. making the configuration easy to change when the password changes, etc. both windows and linux solutions appreciated!

Original source