Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

We just migrated one of our machines to a new box. Same web host, but new IP and physical machine.

I've found a lot of the databases are using a generic dbuser/pw combo. With the new server, I want to implement a more secure policy that all dbs need to have their own users, rather than a user that has global db privileges.

Is there a way to search all the servers' web docs (Everything below /var/www/vhosts/) for references to a specific db username in any files?

Is this a job for grep? Or is there a better solution?

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

Use grep to search for a string within a folder or files

$ grep username /var/www/vhosts/

Grep tutorial http://www.cyberciti.biz/faq/howto-use-grep-command-in-linux-unix/

To search your mysql users run select * from mysql.user; or select User from mysql.user;

share|improve this answer
add comment

[If the code is duplicated on a network machine] I've used dreamweaver for similar searches (yes, I know) it does have a very effective code search tool and a handy interface.

share|improve this answer
    
Unfortunately, it is not. If it were, I could use my text editor of choice. –  Keefer Jan 17 '12 at 20:30
    
Grep it is then! –  toomanyairmiles Jan 17 '12 at 23:47
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.