Disallow a site from sending out emails
Posted by HappyPike, 05-04-2007, 12:51 AM Hi, Is there a way to disallow a certain site from sending out emails, while allowing other sites on the same server? My server uses Cpanel. Also, is there a way to only tar files of a certain type, such as PHP, recursively from a directory? Thanks.
Posted by ThinkSupportAdmin, 05-04-2007, 03:01 AM You can remove the domain entry from the file /etc/localdomains This will disallow emails for that domain.. Yes you can tar particluar files -- you may want to use additional commands -- cp *.php xyzfolder tar -xzvf new.tar.gz xyzfolder/
Posted by HappyPike, 05-04-2007, 03:11 AM Thanks for the help, ThinkSupportAdmin!
Posted by ThinkSupportAdmin, 05-04-2007, 03:37 AM Cheers HappyPike
Posted by HappyPike, 05-04-2007, 03:48 AM BTW, is there anything wrong with this htaccess file? I added my IP to the deny list and it doesn't seem to work.
Posted by Linuxsurgeon, 05-04-2007, 06:38 AM when you are looking at putting a block for an IP you can do it using following rules.
Posted by brianoz, 05-04-2007, 06:58 AM Another way of preventing a site from sending out email is to put a line like in the file /var/cpanel/maxemails. Not sure if this would be more effective than the localdomains idea.
Posted by senne, 05-04-2007, 06:32 PM recursively find . -name "*.php"|xargs tar cvf php.tar
Posted by HappyPike, 05-04-2007, 07:58 PM Thank you all for the quick replies. I will give those commands a try soon. For the htaccess problem, I removed those tags and this works: Fortunately I don't need to deny a site from sending emails now. For the past few days my server were sending out tons of spam emails. I checked the apache log and found that the spammer was injecting an insecured PHP file with a text file containing PHP mailer codes located on a free hosting site. I fixed the page and banned the spammer's IPs. Last edited by HappyPike; 05-04-2007 at 08:05 PM.
Posted by HappyPike, 05-04-2007, 08:11 PM Thanks, senne! I just tried the command and it worked very well! It retains the directory structure too!!
Posted by brianoz, 05-05-2007, 12:48 AM That's a really bad idea - it won't work, but will look like it did! It will work well provided you don't have more than a very few files, but will invisibly lose some of the files if you have more than a very few, as xargs will run tar once for the first batch and once for the second. What you want is: That may only work on some linux/unix versions of tar, so you may instead be able to use the inferior: The problem with this second method is that it also won't work for large numbers of files, although you'll get an error message.