magic of command line find and replace
Media temple did a good job of automatically updating a bunch of passwords when they decided to reset all the passwords on our shared gs account. However, I have to manage 90+ website on that server, and a lot of them have custom scripting that requires a database connection. Like most people I store the connections in their own file… which couldn’t be accounted for in MT’s sweep.
Not a big deal, I logged into SSH and put SED to work, here’s the example:
from the doamins/ directory….
find ./ -name 'connect.php' -type f -exec sed -i 's/oldpassword/newpassword/g' {} \;
And let that sucker run and do the work, it swapped out all instances of the old password with the new password… gotta love automation.
resources:
Linux’s guide to find: http://linux.about.com/od/commands/l/blcmdl1_find.htm
Some helpful examples of SED:
http://www.brunolinux.com/02-The_Terminal/Find_and%20Replace_with_Sed.html