Question

Setup Firewall settings for FTP

Asked by: designitm

Hey,

I have recently installed proftpd version 1.3.2a and now I am trying to setup the firewall settings to open the port 21 which is what the proftpd configuration specifies as the port to use.

I have attached the following iptables script for your review. Thank you.

#Firewall configuration written by system-config-securitylevel
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:RH-Firewall-1-INPUT - [0:0]
-A INPUT -j RH-Firewall-1-INPUT
-A FORWARD -j RH-Firewall-1-INPUT
-A RH-Firewall-1-INPUT -i lo -j ACCEPT
-A RH-Firewall-1-INPUT -p icmp --icmp-type any -j ACCEPT
-A RH-Firewall-1-INPUT -p 50 -j ACCEPT
-A RH-Firewall-1-INPUT -p 51 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp --dport 5353 -d 224.0.0.251 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp --dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp --dport 53 -j ACCEPT
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
COMMIT

                                  
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:

Select allOpen in new window

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-09-06 at 17:42:39ID24711573
Tags

ftp

,

firewall

,

proftpd

Topics

Linux Setup

,

IP Tables/IP Chains

,

Proxy/Firewall Anti-Virus

Participating Experts
1
Points
500
Comments
22

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Proftpd question - passive ftp
    My server is now using proftpd and i want my ftp server to suport both active and passive ftp mode. I have add the directive (PassivePorts 51000 60000 ) and open inbound ports 51000-60000 at the firewall. When i try to use WS_FTP LE to connect my ftp server, i got the follow...
  2. How to open a firewal for Fedora on port 8082
    Hi experts, it is surely a 1-second question for you, where is this GUI? More specifically, I have a server running on port 8082, and I have the router forwarding to it, but there is no connection, so I assume I need to open the firewall, correct? How? Thank you.
  3. How to revert this firewal configuration?
    [root@machine1 monit-5.0-beta1]# iptables -A INPUT -i eth1 -p tcp --destination-port 25 -j ACCEPT [root@machine1 monit-5.0-beta1]# iptables -A INPUT -i eth1 -p tcp --destination-port 2812 -j ACCEPT I used the above commands to open the ports in my firewall .... actully i d...
  4. iptables does not start
    HI, I have install , yum install iptables then service iptables start -> its does not say anything, its just return blank line if i do, service iptables status -> firewal stop bash-3.2# rpm -qa | grep iptables iptables-1.3.5-4.el5 how will i enable my iptables ??

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: mrcustardPosted on 2009-09-06 at 19:29:16ID: 25272469

This should get you going:

-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 21 -j ACCEPT

                                              
1:

Select allOpen in new window

 

by: designitmPosted on 2009-09-07 at 07:59:19ID: 25275470

I had placed that line in the iptables file and found nothing to happen from it. Is it possible that my error can be with ProFTPD or should I get some sort of connection here regardless?

 

by: designitmPosted on 2009-09-07 at 07:59:52ID: 25275476

I know the line you wrote should work though.

 

by: mrcustardPosted on 2009-09-07 at 08:26:59ID: 25275673

Did you restart iptables after adding that line?

 

by: designitmPosted on 2009-09-07 at 09:19:14ID: 25276028

Yes. I even tried rebooting the server. Would ProFTPD be able to stop the connection, or would it only facilitate the account login attempt and reject that?

 

by: mrcustardPosted on 2009-09-07 at 12:36:26ID: 25276915

Can you make sure that you have the following modules loaded:

# modprobe ip_conntrack
# modprobe ip_conntrack_ftp

Make sure that ProFTPD is not just listening on the localhost. You can do this by running the following command:

netstat -nlpt

This will show you what is listening on which ports.

And then change the firewall rule to the following (then restart your firewall):

-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 21 -m state --state NEW,ESTABLISHED -j ACCEPT

                                              
1:

Select allOpen in new window

 

by: designitmPosted on 2009-09-08 at 14:03:05ID: 25286135

This is the line that comes up when I run the command "netstat -nlpt"

tcp        0      0 0.0.0.0:21                  0.0.0.0:*                   LISTEN      15560/proftpd: (acc

As well, how would I be sure that modprobe is loaded. I did a file name check to see if a reference to a file had the same name which there is a file with the name modprobe.

I noticed that the ip address is 0.0.0.0 but running of the correct port. Maybe a setting in the proftpd configuration would need to be set.

Thanks again

 

by: mrcustardPosted on 2009-09-09 at 06:28:59ID: 25290979

Actually this looks ok - the 0.0.0.0 means that it's listening on all network interfaces the numbers at the end are your process id and the name of the daemon.

What happens when you turn the firewall off by running the command:

service iptables stop

If you get an error can you post it? Also please post the error that you get while trying to connect when the firewall is enabled.

Mark

 

by: designitmPosted on 2009-09-09 at 08:50:43ID: 25292528

Hey,

I have stopped the server and this is what I get:

[root@u15320204 sysconfig]# service iptables stop
Flushing firewall rules:                                   [  OK  ]
Setting chains to policy ACCEPT: security raw nat mangle fi[FAILED]
Unloading iptables modules:                                [  OK  ]
[root@u15320204 sysconfig]#

As for my connection to the FTP I am using Dreamweaver by Adobe. I can't copy the error but it basically says that My Firewall settings are not set correctly.

Here is a copy of my proftpd conf file:

# This is a basic ProFTPD configuration file (rename it to
# 'proftpd.conf' for actual use.  It establishes a single server
# and a single anonymous login.  It assumes that you have a user/group
# "nobody" and "ftp" for normal operation and anon.

ServerName                      "drcdn FTP Server"
ServerType                      standalone
DefaultServer                   on
DeferWelcome                    on
MaxInstances                    30
TimeoutStalled                  300

# Port 21 is the standard FTP port.
Port                            21

# Don't use IPv6 support by default.
UseIPv6                         off

# Umask 022 is a good standard umask to prevent new dirs and files
# from being group and world writable.
Umask                           022

# To prevent DoS attacks, set the maximum number of child processes
# to 30.  If you need to allow more than 30 concurrent connections
# at once, simply increase this value.  Note that this ONLY works
# in standalone mode, in inetd mode you should use an inetd server
# that allows you to limit maximum number of processes per service
# (such as xinetd).
MaxInstances                    30

# Set the user and group under which the server will run.
User                            droomftp
Group                           webftp

# To cause every FTP user to be "jailed" (chrooted) into their home
# directory, uncomment this line.
DefaultRoot ~

# Normally, we want files to be overwriteable.
AllowOverwrite          on

# Bar use of SITE CHMOD by default
<Limit SITE_CHMOD>
  DenyAll
</Limit>

<Limit LOGIN>
        DenyAll
</Limit>

I am looking to setup a Virtual Host for a client to access the home directory for their account.

I hope this helps.

Thank you!

Daniel

 

by: mrcustardPosted on 2009-09-09 at 09:19:22ID: 25292830

What happens when you use a regular FTP client? For example FTP from the command line with this:

ftp <hostname>

Also if you are using windows or MAC do you have the machine firewall enabled, this could also cause a similar error.

 

by: designitmPosted on 2009-09-09 at 10:37:57ID: 25293676

I get that it is connected and that the server running is ProFTPD 1.3.2a. So that is good. Then it asks for this next line:

Name (designitroom.com:root):

What should be typed in here? Or is the error in the configuration file for proFTPD because I don't have a Virtual host setup properly?

 

by: mrcustardPosted on 2009-09-09 at 14:16:36ID: 25295658

Looks like it's asking for a userid, the default looks like it's set to root - which may be a misconfiguration or it could be just something it suggests the first time around.

Your getting connected through a regular FTP connection (via the command line) - I would actually start looking at your dreamweaver configuration, because that's where you're still getting the failure.

 

by: designitmPosted on 2009-09-19 at 19:39:42ID: 25375695

hey,

When I type on the command line: "ftp designitroom.com" this message comes up: "421 Service not available, remote server has closed connection"

Would you know what this means?

 

by: mrcustardPosted on 2009-09-19 at 20:09:06ID: 25375744

 

by: designitmPosted on 2009-09-20 at 08:19:10ID: 25377543

So I managed to get it to connect. I believe the error was that the Authorization files for user and group were not referenced correctly.

I am trying to connect to my FTP server using Dreamweaver and the problem persists. I run the command

netsat -tap | grep proftpd

and get this:

tcp        0      0 *:ftp                       *:*                         LISTEN      17599/proftpd: (acc

I have used both passive and non-passive mode and am a little lost from here.

Any suggestions?

 

by: mrcustardPosted on 2009-09-24 at 07:17:27ID: 25413587

If you can connect via command line then the problem lies within Dreamweaver not the ftp server. If you have support with Adobe I would call them and let them take a look. If not you could always ask someone from the experts-exchange dreamweaver group.

Ps. sorry for the late response.

Thanks,

M.

 

by: designitmPosted on 2009-09-24 at 17:10:27ID: 25419195

Hey,

So I realized what the Firewall error was when I was connecting remotely. I think the order or Firewall settings in the iptables source file was incorrectly ordered. So now I am able to connect from Dreamweaver. One last question if possible and then I can close this question off.

If I am running the Proftpd server under the user webserv, and then logging in using another user name but under the same group webftp, the permission and access is denied. So I guess my question would be, how should the user name and setting be set so I can use one user account to run the server but give access to client FTP directories under another user account to upload?

Thanks for your help!

Daniel

 

by: mrcustardPosted on 2009-09-24 at 19:16:01ID: 25419667

Can you do an ls -l and post the out put of the file -- doesn't have to be your actual files, it could be a test file in this case.

Where I'm going with this is - you have to have the user in the same group which you've done, but you also need to give the "group" permissions to read/write the files. So you would want to make sure that your file permissions would look like this:

  U   G   O
-----------------
 -rw-rw-r--   <file owner>   <file group>   <filename>

The "U G O" stands for user, group, owner (respectively). You can test by changing the permission on the test file by doing this:

chmod g+rw <test file>

Thanks,

M.

 

by: designitmPosted on 2009-09-24 at 22:04:20ID: 25420125

Hey,

I tried your suggestion and it does not work, but here is the output anyway, so maybe I am missing something:

drwxrwxr-x 6 webserv webftp  112 Sep 13 14:59 .
drwxrwxr-x 5 root    root     40 Jul 24 12:56 ..
drwxrwxr-x 8 webserv webftp  103 Sep 17 21:12 apps
-rwxrwxr-x 1 webserv webftp 6148 Sep 20 20:27 .DS_Store
-rw-rw-r-- 1 webserv webftp 5533 Sep 25 00:53 index.axs
drwxrwxr-x 5 webserv webftp   52 Sep 13 14:58 lib
-rw-rw-r-- 1 webserv webftp 3699 Sep 20 20:29 login.axs
drwxrwxr-x 8 webserv webftp   80 Sep 21 21:29 nets
-rw-rw-r-- 1 webserv webftp 3408 Sep 20 20:30 srq.axs
drwxrwxr-x 9 webserv webftp 4096 Sep 13 14:59 users


Thanks again!

 

by: designitmPosted on 2009-09-24 at 22:47:02ID: 25420260

Hey,

It is allowing me to upload the file through dreamweaver when I give the owner the ability to write.

What do you think?

 

by: designitmPosted on 2009-09-25 at 00:07:01ID: 31625545

Thank YOU!

 

by: designitmPosted on 2009-09-25 at 00:07:48ID: 25420573

I figured where I was going wrong, when I set the ftpasswd file and ftpgroup file, I used the wrong uid and gid so when it was uploading the reference to the correct user and group was incorrect.

Thank you for you help!

All the best!

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...