Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I configure firewall for what I use as a web development server. I should be blocking all ports except 80 (HTTP), FTP, SSH? I tried configuring using ufw, gufw, firestarter but I ended up blocking myself from surfing the net ... :)

share|improve this question
possible duplicate of How can a non-geek set up a proper firewall? – Lekensteyn May 12 '11 at 10:33
may be if you can include the rules you have created using ufw into your question. we will help you unblocking your self – Achu May 12 '11 at 10:56
@Achu ... I tried to replicate what I did but cant even find a way to block myself even with sudo ufw default deny any ideas? ufw status – JM at Work May 13 '11 at 2:06
@Achu, now, I removed ufw, gufw, firestarter and found that outside cannot access my server... any ideas? – JM at Work May 13 '11 at 2:25
when i see this it seems you didn't removed all configuration. the status is active and you block the port 80 in and out. make sure to remove all firewalls you have installed and configured. and you should use only one firewall ufw or firestarter may it is complex to manage all firewalls. – Achu May 13 '11 at 7:26
up vote 2 down vote accepted

Here is my ufw configuration

sudo ufw enable         #Enable ufw
sudo ufw default deny   #By default deny everything
sudo ufw allow 22       #Allow port 22 (ssh) I also use this for sftp
sudo ufw allow 80       #Allow port 80 (http)
sudo ufw allow 9418     #Allow port 9418 (git) You probably wont need this
sudo ufw limit ssh/tcp  #Limit connections to ssh/tcp to slowdown possible attacks
share|improve this answer
Shouldn't deny be at t6he bottom? – JM at Work May 13 '11 at 4:45
So now I have the following for ufw status and outside still cannot access the server ... I cannot surf the net too ... also the following for iptables -L – JM at Work May 13 '11 at 4:56
No deny shouldn't be at the bottom maybe some of your settings stuck try sudo ufw reset after that retry the commands in the order i posted them – K. Hendrik May 13 '11 at 5:01

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.