What's best way to secure a database connection string?

I am writing a set of database-driven applications in PHP. These applications will run on a Linux server as its own user. Other users will likely be on the system at times, but have very controlled access. Other servers they will not have access to at all. I will also expose a limit stored procedure API to developers who need to write Perl scripts that access the database using a DBI and a set of functions I write.

My question is what the best way to secure the config files that have connection strings in them?

Is a different user with [4+]00 permissions on the file sufficient? Should I encrypt them? That seems to just shift the problem elsewhere so that I worry about where to store an encryption key. I realize the Perl developers will need to have a connection string of their own as they will only have execute database permissions.


If the machine really is being administered in the traditional Unix fashion, where J. Random user isn't off su-ing to root all the time, I'd say that filesystem permissions are your best bet. If someone gets unauthorized root access, no amount of encryption silliness is going to "secure" the connection string.

I'd mark the files w/ the connection string as owned by the "script user" and give them access as you describe.

(Bravo for realizing that encrypting the connection string doesn't buy you anything, in this example. Security through obscurity is counter-productive.)

Need Your Help

ProtoBuf.NET not serializing when using DataContract attributes


I'm using the latest version of ProtoBuf on NuGet ( and it does not serialize types marked with DataContract/DataMember attributes:

How can you export the saved username and passwords in FireFox 2?


I need to reformat my machine but I have so many user/passwords stored in FF2 that I just keep putting it off. Yes I know about backing up the entire profile and restoring it. But for some reason my