Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Member
    Join Date
    Nov 2007
    Posts
    865

    Default Search for files & directories

    Hi,

    How do i search for particular pattern files & directories in entire server

    an account is compromised, here is the details

    Code:
    /home/example/public_html/mailers/1.php
    /home/example/public_html/mailers/2.php
    /home/example/public_html/mailers/3.php
    /home/example/public_html/mailers/4.php
    /home/example/public_html/mailers/Mailer2.php
    /home/example/public_html/mailers/Mailer3.php
    /home/example/public_html/mailers/mailer4.php
    /home/example/public_html/mailers/mailerinbox.php
    So i ran below commands to search for directory "mailers" for other existing accounts & entire server & i got result as below
    Code:
    root@server [~]# find /home -name mailers
    /home/example/public_html/mailers
    root@server [~]# find /home -name mailer
    root@sever [~]#
    root@server [~]# find / -name 'mailers' -type d
    /home/example/public_html/mailers
    i didn't find "mailers" directory in other accounts now i want to search for files
    1.php, 2.php, 3.php, 4.php, Mailer2.php, Mailer3.php, mailer4.php, mailerinbox.php

    in entire server or other in other accounts

    how can i do this ???

  2. #2
    Member
    Join Date
    Nov 2007
    Posts
    865

    Default Re: Search for files & directories

    Is there any update on this ??

  3. #3
    Member
    Join Date
    Sep 2009
    Location
    Athens Greece
    Posts
    201

    Default Re: Search for files & directories

    use maldet and clamav to see if it gets any results if there are viruses on this domain.
    maldet is an excellent free choise you can set it t monitor users as well

    also chirpys exploit scanner is a good solution.
    try also the grep command did you receive any email from the DC that your server is spamming or ddos another box?

  4. #4
    Member
    Join Date
    Nov 2007
    Posts
    865

    Default Re: Search for files & directories

    Quote Originally Posted by k-planethost View Post
    use maldet and clamav to see if it gets any results if there are viruses on this domain.
    maldet is an excellent free choise you can set it t monitor users as well

    also chirpys exploit scanner is a good solution.
    try also the grep command did you receive any email from the DC that your server is spamming or ddos another box?
    yes, i know maldet and clamav these are very good tool, i have already scanned entire system by these tools, but nothing is there. i just visited the website & came to know that it is hacked & then i checked manually pages & found mailers pages, we have not received any email from DC regarding spamming or ddos another box? actually it is not doing spamming.

  5. #5
    Member
    Join Date
    Sep 2009
    Location
    Athens Greece
    Posts
    201

    Default Re: Search for files & directories

    use the grep command
    grep -i -r 1.php /home
    or
    grep -i -r 4.php /home etc

  6. #6
    cPanel Staff cPanelJeff's Avatar
    Join Date
    Sep 2010
    Posts
    80

    Default Re: Search for files & directories

    If your slocate/mlocate database is up to date, another method would be to use the "locate" utility.

    Here's an example:

    Code:
    [user@host ~]$ touch mailer
    [user@host ~]$ ls mailer
    mailer
    
    [root@host ~]# locate -i mailer | grep ^/home
    [root@host ~]#
    
    [root@host ~]# updatedb
    [root@host ~]# locate -i mailer | grep ^/home
    /home/user/mailer
    A few things to note:

    1. Running "updatedb" can take a while. The more files that exist on your machine, the longer it'll take
    2. You may already have a cron job that updates the mlocate database already. This is the cron job:

    Code:
    [root@host ~]# ls -l /etc/cron.daily/mlocate.cron
    -rw-r--r-- 1 root root 137 Sep  3  2009 /etc/cron.daily/mlocate.cron
    This is the mlocate db that contains the list of files and directories on your machine:

    Code:
    [root@host ~]# ls -l /var/lib/mlocate/mlocate.db 
    -rw-r----- 1 root slocate 5602047 Mar 19 09:50 /var/lib/mlocate/mlocate.db
    When "updatedb" is run, that's the file that gets updated. Again, you may already have a cron job in place which does this every day anyway.

    You may also find the "locate" utility to be a bit quicker than running "find" when dealing with large amounts of data.
    cPResources: -- cPJeff - Jeff P., Technical Analyst, cPanel Technical Support - Need to submit a ticket? (click here) - Need to check on an existing ticket? (click here)

Similar Threads & Tags
Similar threads

  1. find word in the files & search
    By crazyaboutlinux in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 02-04-2010, 07:37 AM
  2. can't delete/rename files and directories
    By mraab in forum New User Questions
    Replies: 5
    Last Post: 10-13-2008, 06:33 PM
  3. Search engine crawl +Virtual directories [moved]
    By sirloin in forum New User Questions
    Replies: 5
    Last Post: 07-25-2005, 03:26 PM
  4. [Q] Changing group on files&directories to the apache group
    By tekenen in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 08-02-2004, 09:01 AM
  5. cpbackup just has directories - not tar.gz files
    By rastoma in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 09-06-2003, 07:51 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube