Online Help » DreamHost

Setting up .cgi scripts on DreamHost requires initiating a secure SSH shell to the server.

Step 1 – Set up a user with shell access and an email account. Under "Users" -> "Users" in the DreamHost control panel, click "Add New User". For the "Type of User Account", switch the radio button so that the "Shell account" option is selected. Leave the shell choice at default. Your "Username" must be unique on the server, so if your site is "example.com" you might set it to "ex_bounce". Set up a password for the new account. Click "Add User". On the next page, choose any one of your hosting plans and click "Continue". The next page asks you to select an email address. Since we're setting up bounce under this user, enter "bounce" (@example.com).

Step 2 – Connect via SSH. If you already know how to connect via SSH and have an SSH client you can skip this step. First, download an SSH client. Install the client. Load the client using the shortcut "Secure Shell Client" (not the other shortcut, "Secure File Tranfer Client"). Click "Quick Connect". For the "Host Name", assuming your domain DNS already resolves to dreamhost, enter your domain name, ie "example.com". Under "User Name", enter your bounce user, ie "ex_bounce". Leave the "Port Number" at "22", which is the default for SSH connections. Also leave the "Authentication Method" at the default. Click "Connect". Click "Yes" when the warning appears. When asked, enter the password for the "ex_bounce" user. If all goes well you will be connected via SSH to the dreamhost server hosting your web site. If the connection is successful, you might see something like this (with "server" being replaced by the name of the DreamHost server your site is hosted on):

Welcome to server.dreamhost.com
 
Any malicious and/or unauthorized activity is strictly forbidden.
All activity may be logged by DreamHost Web Hosting.
 
Last login: Sat Apr 2 01:41:50 2005 from 1234567890.example.net
[server]$

The last line "[server]$" is a Linux command prompt. You might try some of these basic commands.

Step 3 – Set up the mail system to forward to bounce.cgi. This is where it gets tricky. You're going to need to edit a file from the Linux command prompt! I'll step you through it. First, we'll use the "vi" editor. Type the following from the command prompt, followed by ENTER:

vi .forward.postfix

Now, the editor should be loaded. You will see something like this:

~
~
(more of the lines above)
.forward.postfix: new file: line 1

Press "i" once to go into insertion mode. Enter the following on one line, *including* quotes:

"|/usr/bin/procmail -t"

Save the file. (Hit ESC, then type (no quotes) ":wq" and hit ENTER). You will see this, which indicates the file was written:

.forward.postfix: 1 lines, 24 characters.

Now, we need to set up another file. Copy and paste the following into Notepad and modify it to match your site and username.

DEFAULT=$HOME/Maildir/
MAILDIR=$HOME/Maildir
PMDIR=$HOME/.procmail
SHELL=/bin/sh

:0
* ^TO_bounce@example\.com
| /home/ex_bounce/bounce.cgi

Run the following command from the prompt to again create a new file:

vi .procmailrc

Again, press the "i" button to go into insertion mode.

Copy and paste the contents of the file above. Save the file. (Hit ESC, then type (no quotes) ":wq" and hit ENTER).

Verify the files with "cat", a linux prompt file-reading utility:

cat .forward.postfix
cat .procmailrc

Step 4 – Set up bounce.cgi. The easiest way to do this is to follow the same procedure as used by .procmailrc above. First load the cgi/bounce.cgi file from the ListMailPRO zip in Notepad. Modify line 8 to reflect your ListMailPRO installation domain and path. Copy the entire contents of bounce.cgi into a new file via the "vi" editor.

Once the file is created, give it the required executable permissions with the following command:

chmod +x bounce.cgi

Step 5 – Verify it. 1 – 2 hours after creating the username and email address, providing you have set up the mail forwarding and bounce.cgi correctly, it should start working. To test it, enable bounce.cgi on the ListMailPRO Config page, set up the correct "Bounce to address", and click the "Test Mail Settings" button. If all goes well you will receive a success message at your ListMailPRO "Administrator Email" address.

To set up email signup, repeat steps 1 through 4 substituting the desired/required email address and cgi script.

You can set up your cron task under the bounce user. Check out the "Set up cron with SSH" -> "Pico Editor" section.

Next: Bounce Mailbox

Related: Pico Editor