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 TAR a file or folder, GZIP, and UNTAR (create TAR files archive)

If you’re running a Linux based server, here a step by step guide on how to tar a file and then how to gzip (compress) that file using a simple SSH command.

When you are logged into your server through SSH, you can use this command line to tar and then gzip your folder into a tarball file. This will compress your file into the current directory

  • tar -czf whatever.tar foldername
    (another method would be…)
  • tar -czf whatever.tar.gz foldername

If you’d like to tar your file and have it put in another location use this:

  • tar -czf /directory/directory/whatever.tar foldername

Now that you have a tar file, here’s how to untar / ungzip (or unzip, uncompress) a file in SSH. Using this command you’ll untar and uncompress your file, then it will place that folder in the directory you are currently in restoring your old folder and file structure.

  • tar -xf whatever.tar
    (another method would be…)
  • gunzip -dc whatever.tar.gz | tar xvf –

Here are a list of tar options, and their significance.

-c = create
-f = read to/from the named file (instead of the device /tape)
-t = list contents of .tar file
-r = append to a .tar file
-v = verbose (tells you everything its doing)
-x = extract contents of .tar file
-z = compress files

Want to learn more SSH commands? I recommend the book Linux in a Nutshell

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

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

How to choose the right hosting service for a video website

Choosing the perfect web hosting service is honestly not an easy task. Nowadays there are literally thousands of them to go through, with almost 90% of them being identical, which makes it even harder to choose from. So there are a few decisive factors which have to be met by the hosting service, for you to choose the right one.

1. Analyze the disk space provided:
There can be nothing more important than the disk space for a video website. Everybody knows that videos take up a ton of space depending on their quality, and people who visit these sites only go for high quality videos. So that means the videos uploaded should be of high quality and that directly leads to the videos taking up loads of space.

2. Bandwidth, what is it and why should it be huge?
Meaning, the bandwidth provided should be strong enough to withstand traffic. Ok, basically a bandwidth is a virtual road that can hold thousands of virtual cars, in this case the viewers. If the road is not wide or strong enough, it may cause a traffic jam or even worse break and fall apart. So wide road more cars, wide bandwidth more viewers/hits.

3. Is FTP access provided?
FTP is a software that is used to upload videos to the website without logging into the account each and every time you want to upload a video. Now most of the hosting websites are providing this service, but it’s never wrong to be sure right?

4. Customer Service is extremely important
It’s always a good thing to find a host service that provides first-rate customer service. Ken from suggests that you send them an email and see how quickly they response to it to determine this factor. Try to find a host who can provide it 24×7, so that any viewer problems or hosting problems can be solved ASAP. Checking for hosts who can provide all these can be considered a right host for a video website.