Tag: FAQs Help and Tutorials
Pure-ftpd does not work with centos vps ispconfig The Perfect Server
by Eric on May.10, 2010, under Linux
So you're following the tutorial at The Perfect Server - CentOS 5.4 x86_64 [ISPConfig 3] and when you get to installing Pure-FTPD you get FAILED on start, and see
May 10 08:09:58 pimp pure-ftpd: (?@?) [ERROR] Unable to switch capabilities : Operation not permitted
in the logs. Well, the answer is at hand. Rather than looking through countless google entries to find the answer buried on page three or four, just go here, where the folks at newart-design.net have put together the answer. Make sure to yum install first, that way you can chkserv on and use /etc/init.d to control.

Default Mail Clean Script
by Eric on Mar.17, 2009, under Linux, Scripts
Here's a quick little script to clean the default mail accounts of mail on cPanel servers. Note that this only helps if you have already disabled the catchalls.
#!/bin/bash
###############################################
# CLEAN MAIL #
# v0.1 #
# #
# Cleans the mail from default accounts based #
# on cPanel usernames. Create a file in /root #
# called 'doit'. Add one cPanel username per #
# line. That should do nicely. Oh, this will #
# take a while, so run the sucker in screen, #
# mkay, Batman? #
###############################################
# Some dedis have LS_OPTIONS include -a...
# that would be bad for this script.
# so, we reset it.
LS_OPTIONS='-A'
# start the loop...
for i in `cat /root/doit`
do
# Delete from the new folder.
cd /home/$i/mail/new
# can't rm if there's too many, and by using
# an ls and awk, we avoid another loop.
ls -l | awk '{print "rm -fv "$9}'|bash
# Delete from the cur folder.
cd /home/$i/mail/cur
# Comment repetition carefully avoided, here ![]()
ls -l | awk '{print "rm -fv "$9}'|bash
done
# NINJAMOJO!
It's simple. Get a list of cPanel usernames, one per line, create a file in /root called 'doit', and slap the usernames in there. Then, 'bash cleanmail'.

Removing malicious code with perl and sed…
by Eric on Feb.10, 2009, under Linux, One-liners
Today, I had an instance where a customer's site had been attacked with a code injection affected all of his .php files. In this case, it was an old vBulletin install that had several known exploits on milw0rm (proof you should update often) that caused it.
Fortunately, the code was injected as a single line, and was the same in every file, and had the added benefit of being on the top line of the file. So, I could use abit of perl to remove it, and then a bit of sed magic to remove the blank line left by Perl (because for some reason, it didn't want to remove the newline).
