RSS Forums RSS
Please support our IT Professionals' Lounge advertiser: Programming Forums
Views: 5611 | Replies: 43 | Solved | Thread Tools  Display Modes
Reply
Join Date: Jan 2007
Location: Israel
Posts: 1,677
Reputation: DimaYasny will become famous soon enough DimaYasny will become famous soon enough 
Rep Power: 6
Solved Threads: 77
Featured Poster
DimaYasny DimaYasny is offline Offline
Posting Virtuoso

Re: apache as an ftp server

  #41  
Jan 17th, 2008
If you are running iptables and your clients use non-passive FTP (like Internet Explorer), you also have to make sure the ip_conntrack_ftp kernel module is enabled. This module takes care of connection tracking for FTP. If you are experiencing problems connecting to your FTP server through active FTP, load this module and see if it solves it.
Code:
[user@host ~]# modprobe ip_conntrack_ftp


This is reset every time you restart iptables (so also when you reboot your server) so you might want to add it to the iptables configuration, so it is loaded automatically.
Code:
[user@host ~]# vi /etc/sysconfig/iptables-config


Go to insert mode and change IPTABLES_MODULES="" to...
Code:
IPTABLES_MODULES="ip_conntrack_ftp"


Save & exit once again by pressing <ESC> and typing

http://www.evilgeekz.com/viewtopic.p...8e716c66871060
Real stupidity always beats Artificial Intelligence. (Terry Pratchett)

BA BizMg, MCSE, DCSE, Linux+, Network+
Reply With Quote  
Join Date: Jan 2008
Posts: 38
Reputation: williebens is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
williebens williebens is offline Offline
Light Poster

Re: apache as an ftp server

  #42  
Jan 30th, 2008
This is the solution I got to get my ftp server running.

I was first running CentOS 4.x and it did not work. My server complained when I stopped it claiming that there was a file locked under the /var/lock/subsys. The name of the file is vsftpd. The ftp server I am using is vsftpd. When I upgraded to CentOS 5, this complain disappeared.

Steps:

1. Download the server daemon using the following command (you have to have root access) (CentOS, Fedora, Red Hat):
yum –y install vsftpd

2. To start, stop, check the status, and restart the vsftpd server, do these commands:

/sbin/service vsftpd start
/sbin/service vsftpd stop

/sbin/service vsftpd status
/sbin/service vsftpd restart

3. To configure vsftpd to start at boot, use the following command:

chkconfig vsftpd on

The previous command will make sure that if you turn you computer off, the vsftpd server will start automatically after the computer is turned back on again.

4. Another way to test the status of the vsftpd process, other than by
the /sbin/service vsftpd status command, is by typing the following command:

netstat -a | grep ftp

You should get the following output or something similar:

tcp 0 0 *:ftp *: * LISTEN

If the vsftpd is stopped, then there would be no output.

5. Now I will create users that will share the same directory and will only have read- only access to it. Just follow the following steps:

Disable anonymous FTP, in the vsftpd .conf file found in the /etc/vsftpd/ directory, since we are using authenticated users only:

#Allow anonymous FTP?
#anonymous_enable =YES

You can either comment anonymous_enable out or just set it to NO instead of YES.
Set local_enable = YES to enable individual logins.

Start your vsftpd server: /sbin/service vsftpd start

6. Create an ftp group and the directory all ftp users will share:

groupadd ftpusers (this is the ftp group).
mkdir /home/fptdocs

7. Make the directory accessible to the users that belong to the ftp group (ftpusers):

chmod 750 /home/ftpdocs
chown root.ftpusers /home/ftpdocs

8. Create ftp user accounts:

useradd –g ftpuser –d /home/ftpdocs ftpuser (where ftpuser is the user who can upload/download documents to/from the ftp server).

passwd ftpuser

Now this user should have the necessary permissions to upload/download files via ftp.

9. Change the permissions of the file in the /home/ftpdocs directory to whatever permissions you need. For example, to only download files the permission would be read-only and execute. To upload/download files, the permissions would be 770 as long as the user belongs to the ftp group. If the user does not belong to the ftp group, then the permissions would be 777. Note: I need you to modify these permissions to your needs in case they are not what I am claiming they are. The reason is that uploading/downloading depends on the permissions you set for your ftp directory and whether or not your ftp user is part of the ftp group. If for any reason, my statements on this section are wrong, please correct me. Thanks.

If I want to give ftp users only read-access to the directory, note that they would only be able to download files with this type of access, I would do the following:

chown root.ftpusers /home/ftpdocs/*
chmod –R 740 /home/ftpdocs/*

10. Restart your vsftpd server for any configuration changes to take place.

11. I used SmartFTP as my ftp client. You might want to download it and test it to see if you would like to use it as well. Otherwise, choose one of your like. SmartFTP has a tutorial that shows you how to login to the ftp server and upload/download files.

12. The following sites might be worth visiting:
http://vsftpd.beasts.org/vsftpd_conf.html

http://www.brennan.id.au/14-FTP_Server.html

http://www.nslu2-linux.org/wiki/Optw...Unslung.Vsftpd

If you do not want your ftp users to have access to your Linux box, please go back up and review one of the previous postings regarding that issue. You can also create ftp accounts with PAM/MYSQL. I cannot get into the details of that since I have not done it, but if any of you would like to contribute to this thread on that, please do.

Thanks Dima and all others for your help.

Note: I did not proofread this and my apologies for my lateness.

--Willie
Last edited by williebens : Jan 30th, 2008 at 2:03 pm.
Reply With Quote  
Join Date: Jan 2007
Location: Israel
Posts: 1,677
Reputation: DimaYasny will become famous soon enough DimaYasny will become famous soon enough 
Rep Power: 6
Solved Threads: 77
Featured Poster
DimaYasny DimaYasny is offline Offline
Posting Virtuoso

Re: apache as an ftp server

  #43  
Jan 30th, 2008
glad to see you have it figured out for yourself
Real stupidity always beats Artificial Intelligence. (Terry Pratchett)

BA BizMg, MCSE, DCSE, Linux+, Network+
Reply With Quote  
Join Date: Jan 2008
Posts: 38
Reputation: williebens is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
williebens williebens is offline Offline
Light Poster

Re: apache as an ftp server

  #44  
Feb 12th, 2008
Hello to you all:

Another thing I would like to add regarding the ftp server is the fact that it is possible that you do not want users to delete files they do not own. I went through this yesterday. Remember that my ftp users all share the same ftp folder to place their files. Therefore, if user1 uploads files, user2 can download it or delete it the way this is configured so far. My way around this problem was setting the sticky bit. The way I did this was as follows:

Assuming that the path where you have your ftp documents is /home/ftpdocs, then run the command:

chmod +t /home/ftpdocs

This will disable user1 from deleting files uploaded by user2 and vice versa.

Now, please, if there is a better way of doing this, let me know.

Thanks.
--Willie
Last edited by williebens : Feb 12th, 2008 at 12:07 pm.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.



Similar Threads
Other Threads in the IT Professionals' Lounge Forum
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 7:27 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC