ubuntu

For the life of me I can't seem to remember these simple commands to edit IPTables so I just wanted to document the few that I seem to be using the most:

View current rules
View a list of current rules
iptables -L

Insert a new rule
This will insert a new rule in the INPUT chain in the number 5 slot:
iptables -I INPUT 5 -p tcp --dport [port] -j ACCEPT

Insert a new rule and allow only from specific IP address
This will insert a new rule in the INPUT chain in the number 5 slot and only allow a connection from the IP address specified:
iptables -I INPUT 5 -p tcp -s [ip address] --dport [port] -j ACCEPT

Delete specific rule
This will delete rule number 5 from the list. Change the 5 to whatever number you need to delete
iptables -D INPUT 5

Save rules to a file
Make sure to save the rules to a file so they are applied upon boot. Note that I needed to use the "sh -c" option for sudo or you will get a permission denied error

Continue reading...

There are many times, for one reason or another, that I need to transfer a Drupal website from one server to another. I was used to using tools like Filezilla and phpMyAdmin to get most of the heavy lifting done, but after doing this many times I've found the command line to be my friend.

I use linode.com so I know how my server is configured, what's installed, and more importantly have shell access. If you use a shared host this guide/checklist probably won't help you out too much.

To prep the site I do a couple of quick changes:

  • Set to offline mode to prevent any more changes taking place in the database
  • Turn off caching/compressing mechanisms and flush all caches

Once those are done, here are the steps I use to transfer the site:

In my case the folder structure is usually set to something like the following:

/home/user/www/example.com
  /cgi-bin
  /htdocs
  /logs

Continue reading...

Proftpd and Mysql

20 May 2009

I recently had to setup FTP access on one of my servers which is running Ubuntu 8.04. I decided to go with proftpd tied in with MySQL for authentication. There were a couple of bumps and bruises along the way, but I was able to find some great resources to help me get it setup. That being said, I learned a couple of things along the way that weren't listed in the other tutorials I looked at so I though I would document the steps I used to create my FTP server.

Continue reading...