NOTE: THIS ARTICLE IS NOT YET COMPLETE AND VERIFIED. It is generally recommended that you disable FTP on your server if you don't really need it. The main reason for that is that FTP has a history of security issues and most common implementations are easy to exploit. FTP is nevertheless a convenient way to share files and allowing others to store files on your server can be very usefull. However, there are some considerations to be taken to make things a bot more secure:
A good candidate for FTP service is Here I detail a possible configuration of InstallationOn most systems, installing # apt-get update # apt-get install vsftpd If you are on a Redhat or Fedora system and not using You can of course choose to install everything by hand and compile from source. Check out the links below for more detail information about manual installation.
ConfigurationThe main configuration file is Open # --------------- Main Options # Allow local users to log in local_enable=YES # Allow anonymous FTP anonymous_enable=YES # Allow anonymous upload and make them owned by the unpriviledged ftp user anon_upload_enable=YES chown_uploads=YES chown_username=ftp # --------------- Security Options # Ensure that local users cannot wander into the filesystem chroot_local_user=YES # Limit the number of clients to avoid resource attacks max_clients=20 # Don't shown the real user and group ID, just show as ftp hide_ids=YES # Make sure uploaded files are not executable file_open_mode=0666 local_umask=0117 # --------------- Misc Options # Banner displayed when client connects ftpd_banner=Welcome to my very own FTP service. # Enable logging of uploads/downloads xferlog_enable=YES # PORT Transfer connections connect_from_port_20=YES # Allow recursing by clients ls_recurse_enable=YES Now that the ftp service is configured, just enable it to run through reboots: # chkconfig vsftpd on chkconfig sends a SIGHUP signal to the # tail /var/log/messages Nov 28 20:34:52 testserver xinetd[12931]: Starting reconfiguration Nov 28 20:34:52 testserver xinetd[12931]: readjusting service imap Nov 28 20:34:52 testserver xinetd[12931]: readjusting service pop3 Nov 28 20:34:52 testserver xinetd: xinetd -HUP succeeded Nov 28 20:34:53 testserver xinetd[12931]: Reconfigured: new=1 old=2 dropped=0 (services) Access ControlLocal UsersThere are many mechanisms to control access to the server. Here, we'll use the credentials of local users defined on the machine to decide if they have access to their respective home directory when they login with their normal login/password. Usually, I disable users from being able to access a terminal on my server in 2 ways:
For a local user to be able to log into a ftp server, he needs to have a login account on the machine, so these users need to have a proper login entry in the mike:x:1001:1001:Mike SMITH:/home/mike:/bin/nologin john:x:1002:1002:John DOE:/home/john:/bin/sh Here, only John will be able to access his files through FTP. As explained above, since he is not explicitely in the Anonymous accessBy default, the One concern with anonymous access is that anyone could use your server as a storage for their files. They would eat your bandwidth and, worse, would expose you to legal prosecution if the content shared is illegal. This is a big risk, but we still want people to be able to upload safely.
A simple and safe way to enable that is to create an To achieve this, the simple magic of *nix user and group access is enough. Perfom the following as # cd /var/ftp # mkdir incoming # chown root.ftp incoming # chmod 730 incoming And that's it. Firewall settingsUnless you only want people on your local network to use your ftp server, you must open your firewall just enough for access from the Internet. FTP traffic is quite cumbersome to filter: if your rules are too strong, ftp won't work very well, and if they are too lax, you are at greater risk of attack. The difficulty of protecting ftp traffic is that is comes in 2 flavours: passive and active mode. While ftp uses port 21 to initiate a connection, the server will open other ports to allow data to be sent back to the client. In particular port 20 and ports above 1024. ..... If your firewall is separate from your server, then you need to open port 21 and forward it to your ftp server. More likely, your server will be directly connected to the Internet and will be protected through <:vspace> Links
Leave your comments below |