How to add FTP users to Pure-FTPd

Detailed instructions here…

Here are my basic instructions


  • pure-pw useradd USERNAME -f /etc/pure-ftpd/pureftpd.passwd -u 48 -g 48 -d /PATH/TO/YOUR/DOMAIN


  • vi /etc/pure-ftpd/pureftpd.passwd


  • pure-pw mkdb /etc/pure-ftpd/pureftpd.pdb -f /etc/pure-ftpd/pureftpd.passwd

Now when you view the pureftpd file (example: /etc/pure-ftpd/pureftpd.passwd) it will look something like this


How to add to and edit iptables

If you’re using a firewall on your server, you’ll want to edit your IPtables. Here’s how you can add new IPs or edit existing ones. Remember port 22 is for ssh and port 21 for FTP.

  • vi /etc/sysconfig/iptables

Edit the IPs in /etc/sysconfig/iptables. Then save changes and run this command to commit changes

  • service iptables restart

Successful service iptables restart should result in this:

Flushing firewall rules: [  OK  ]
Setting chains to policy ACCEPT: filter [  OK  ]
Unloading iptables modules: [  OK  ]
Applying iptables firewall rules: [  OK  ]

Example of what iptables should look like

Or search google for “example iptables config file”

How to clear the Qmail Queue (clean & delete it quickly)

Awe shiznit!! Is your qmail queue on your server out of control? Look no further! Here’s a quick and easy way to clear, clean, or empty your qmail queue.

Clear & Clean Qmail Queue Completely, Safely & Fast!

This script should not remove anything it should not remove, and it should clear all e-mail from your qmail queue safely so you can start sending mail normally again. (This is for qmail only and not a solution for any other mail programs.) You’re going to need ssh access and an ssh program like putty or putty portable.

Let’s get busy with the Qmail Clear script:

  1. Log into your server through ssh
  2. type this:
    su –
  3. type this:
  4. type this:
    sh or sh ./
  5. done.

I took the downloadable script down so you’ll need to write it yourself, but just as a quick summary so you know what it’s doing, the Qmail Clear script looks like this:

echo Cleaning Queue
mv /var/qmail/queue/lock /root/
cd /var/qmail/queue; find . -type f -exec rm -f ‘{}’ \;
mv /root/lock /var/qmail/queue/
echo Queue is now Clean

If this didn’t do the trick and you’re receiving oversized file truncating errors (or “Argument list too long”) then you should use this more intense script. It will take longer but it will get the job done.

Let’s get busy with the Qmail Clean script :

  1. Log into your server through ssh
  2. type this:
    su –
  3. type this:
  4. type this:
    sh or sh ./
  5. done.

DO NOT restart any process. DO NOT reboot the server. DO NOT do anything until the script says it is done. If you restart a process, etc, it will break qmail and that’s no fun. Just run the script until it’s complete.

You can download the script and view all of the code yourself, but here’s a quick summary of the main lines of code so you know what’s taking place when running the Qmail Clean script:

echo “Stopping Qmail”
/etc/init.d/qmail stop
echo “Clearing the Mail Queue”
cd /var/qmail/queue/info
rm -rf blah blah blah
echo “Info folder clean, clearing mess folder”
cd /var/qmail/queue/mess
rm -rf blah blah blah
echo “Mess folder clean, clearing remote folder”
cd /var/qmail/queue/remote
rm -rf blah blah blah
echo “Remote folder clean, clearing intd folder”
cd /var/qmail/queue/intd
rm -rf blah blah blah
echo “Intd folder clean, clearing local folder”
cd /var/qmail/queue/local
rm -rf blah blah blah
echo “Local folder clean, clearing todo folder”
cd /var/qmail/queue/todo
rm -rf blah blah blah
echo “Mail queue cleaned”
echo “Restarting Qmail Now”
/etc/init.d/qmail start
echo “Qmail Started!”
echo “Done!”

If you’re interested in reading more about Qmail I recommend this book Qmail book and also these links:
A reference for qmail users –
A qmail tutorial site – Life With Qmail

How to add a new IP to your server

Need to add a new IP to your server? Here’s how you can do it easily.

Add new IP to server by adding it to your httpd.conf file using the following. First launch the conf file in a text editor like this


Save that conf file. Then restart the service using this command

service httpd restart

And… BOOYA! Finished.

How to use basic VI commands

I’m bored right now so I’m messing around on my server. Sometimes people forget VI Commands so I thought I’d share some basic VI commands. Hopefully this quick reference can help somebody out. For those that don’t know, VI is an editor used in the Linux/Unix environment to edit files that contain text.

To edit a file in SSH you’ll run this command

vi /path/to/file/

First… you must learn there are 2 different modes.

Insert mode and Command mode

hit escape to enter command mode.
from command mode… these are the keys to go into insert mode

i => will make you start inputing at the cursor
a => will make you start inputing after the cursor
o => will open up a new line below the current line your cursor is on,and move the cursor there.

when in insert mode, hit the escape key to enter command mode again
basic command mode commands

:w => save the file
:wq => save the file and quit
:q! => quit w/o saving

/textstring => searches for the textstring in the file ( hit n to find
next instance and N to find previous )

simple copy and paste

yy => yanks single line ( aka copy line into buffer)
p => will paste buffer onto the line below where the cursor is.

to get fancy, you can prepend yy with the number of lines you want to
copy ex .

5yy  => will yank 5 lines from where the cursor is and below in the buffer
p => will paste those 5 lines

dd => cuts single line ( aka cuts line into buffer )
p => will paste cut buffer onto the line below where the cursor is.

And that’s about it. For more in depth instructions you can check out these two sites:

How to empty the qmail queue

To clear all messages from the queue the first step is you must shut down qmail. Here are the SSH commands for that.

  • Using qmail-rocks scripts:
    /etc/rc.d/qmail stop
  • Or you can try the following
    qmailctl stop
  • Or you can try this
    init.d/qmail stop

To clear the qmail queue, use the following SSH commands to change to the queue directory and clear the queue.

  • cd /var/qmail/queue
  • find intd todo local remote mess info bounce -type f -print |xargs rm

After it’s clear you can start qmail back up using a similar command that stopped the service, but say start.

  • Using qmail-rocks scripts:
    /etc/rc.d/qmail start
  • Or you can try the following
    qmailctl start
  • Or you can try this
    init.d/qmail start

Now the queue should be empty!

For learning the ins and outs of Qmail I recommend this Qmail book

How to fix sendmail, iptables, and email delay/not sending

I had some issues with sendmail actually sending out an e-mail. Then sometimes if I stopped the iptables firewall some emails would make to my inbox but that’s quite a big delay. What I had to do to get my mail working smoothly and sending right away was to allow my server’s (or lan) IP address to access sendmail. Here’s the code I put into my iptables config file. I couldn’t find a real solution that worked for me so I edited /etc/sysconfig/iptables and copied this

-A INPUT -p tcp -s 0/0 –sport 80 -d MYSERVERLANIPHERE –dport 1024:65535 -m state –state ESTABLISHED -j ACCEPT

Then pasted, and changed the port to 25 instead of 80

-A INPUT -p tcp -s 0/0 –sport 25 -d MYSERVERLANIPHERE –dport 1024:65535 -m state –state ESTABLISHED -j ACCEPT

Then I restarted my firewall (service iptables restart) and booyah! Shiz iz workin.

If you’re a server admin, another thing you might be interested in is how to clear the qmail queue.

How to check free disk space on FreeBSD server

How can you check and display free disk space available on a FreeBSD server? The best way is using the command ‘df -h’ and here’s exactly what I found from doing some research online. Just type “df” (df means disk free) which will show you the raw numbers or you can type “df -h” which means human readable and makes the output easier to read by displaying it in kilobytes, megabytes, and gigabytes instead of the default kilobytes.. I did this on one of my servers and here’s what it will look like…

SSH commands for checking freebsd server disk space

Here’s text from one server:

-bash-3.2$ df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/md2             1888170872  83453524 1707256624   5% /
/dev/md0                101018     20914     74888  22% /boot
tmpfs                  4088788         0   4088788   0% /dev/shm
-bash-3.2$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/md2              1.8T   80G  1.6T   5% /
/dev/md0               99M   21M   74M  22% /boot
tmpfs                 3.9G     0  3.9G   0% /dev/shm

Here’s text from another server:

$ df
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/ad0s1a 128990 60892 57780 51% /
/dev/ad0s1f 257998 1440 235920 1% /tmp
/dev/ad0s1g 155014798 126948208 15665408 89% /usr
/dev/ad0s1e 257998 10454 226906 4% /var
procfs 4 4 0 100% /proc
/dev/ad3s1c 384602638 13645514 340188914 4% /usr/www/virtual/yyy/drive2
$ df -h
Filesystem Size Used Avail Capacity Mounted on
/dev/ad0s1a 126M 59M 56M 51% /
/dev/ad0s1f 252M 1.4M 230M 1% /tmp
/dev/ad0s1g 148G 121G 15G 89% /usr
/dev/ad0s1e 252M 10M 222M 4% /var
procfs 4.0K 4.0K 0B 100% /proc
/dev/ad3s1c 367G 13G 324G 4% /usr/www/virtual/yyy/drive2

If you want to know more about FeeBSD and server commands, I recommend this book: Absolute FreeBSD: The Complete Guide to FreeBSD