Running web and FTP servers: part three
Over the last two issues we've covered the basics of securing your PC against hacker intrusion, and installing and operating your own web server using Apache. This month, it’s time to share your broadband connection and personal files with the world using an FTP server. With nothing more than the NETFile software on this month’s CD and DVD, you can set up a personal file server.
Now that you have your own personal web server up and running, and your PC is bolstered against unwanted intrusion attempts, you should be just about set up as a small but perfectly formed Internet mini-site. Web servers are fine if all you want to provide is information to the world, but HTTP traffic is essentially one-way – from your PC to the remote machines who connect to your site. While it’s also perfectly possible to host large files for download from a web server, it’s not the most practical way to distribute your products or work to the world in general. To begin with, most web browsers can’t resume interrupted transfers from where they were broken, which means that users may give up downloading a file from you if either you or they have connectivity problems. Likewise, people can’t send you files via a web server, and need to resort to good old fashioned email attachments.
File Transfer Protocol
A more elegant solution exists in the shape of FTP, the Internet’s original File Transfer Protocol. For those of us who were using modems before the Internet took off, you can think of an FTP server as being like an old-fashioned bulletin board or BBS. Essentially, it’s a central point where users can connect to download or upload files from a pool. FTP transfers can also be resumed from where they were interrupted, making it a much more efficient way to distribute large files. The server software we’re using for this Masterclass is called NETFile and comes from Fastream. This is a small, compact personal server application which handles the FTP protocol very nicely indeed. It’s also a nifty little alternative to Apache on the web server front – read the section entitled ‘NETFile web server’ for more on this.
Once installed, NETFile is up and running right away in both web and FTP server terms with no initial configuration required. As it stands, the FTP server is both pretty basic and essentially useless, and you need to make some changes to the settings if you’re going to get the most from it.
User accounts
FTP servers aren't explicitly open to connections in the same way that web servers are. Rather, FTP servers operate around the idea of user accounts and their associated privileges, just like when you login to a normal networked PC. NETFile will have created a single default user for you, called Anonymous. If you’ve ever clicked an FTP link in Internet Explorer or downloaded with a dedicated client like WS_FTP, you’ll know about anonymous users. If not, it’s very straightforward.
Click ‘FTP Default’ in the left-hand pane of the main window. Next, click the ‘Settings’ tab, which opens the main user account window. Click the ‘Anonymous’ user to highlight it, and the ‘Directories’ window will change to display C:\NFRoot\ as the only shared folder. This is the default file download folder for anonymous users, and it’s less than ideal for one simple reason – it’s also the default directory for NETFile’s web server, so anyone connecting anonymously has full download access to your entire web site if you create one.
To move the default download folder, simply click the ‘Add/Remove Folder’ button and navigate to your directory of choice. By all means create a sub-directory within NFRoot and use this. Once done, you need to select the C:\NFRoot\ entry again, then click the ‘Add\Remove Folder’ button again, selecting Delete this time.
When the folder is highlighted, you’ll see that the ‘File Rights’ display changes. Make sure that Home Folder is checked, and that Download, Change and List are also switched on. The first simply means that this is the folder that the user will see when first connecting. Download specifies that users can retrieve files from this directory, which you obviously want left on. Change isn’t as ominous as it sounds. It simply means that users can change directory in and out of this folder. Finally, List means that users can use the ls –la or dir commands to see what files are held within the folder.
Upload areas
Most FTP sites have an upload area, where users can submit files. If you choose to do this, make sure you create a completely separate folder, highlight it, and alter the File Rights so that Upload is enabled for that directory. Most sites don’t allow users to see what’s in this folder, let alone download stuff. This is a good idea, as it prevents dodgy types from using your site as a repository for pornography and other illicit wares. Make sure that both List and Download are switched off. Once you verify that uploaded files are fine, you can move them to the main download directory structure.
You can also create specific user accounts, complete with passwords. Click the User button and enter the username and password you want. Again, you can highlight this new user and change the rights to control exactly what they can and can’t do. NETFile also supports groups, so that you can assign sets of privileges to users very simply. Create a group with the Group button, set the rights to your satisfaction, then add users to the group by dragging-and-dropping them into the group name. Clicking the Options tab opens a few parameters that you may want to play with. In particular, you can switch on Enable reverse DNS resolution in logs. This adds meaningful hostnames to log entries rather than simply adding IP addresses when users connect.
Finally, if you want to customise what a user sees when they connect, alter the Use Custom Banner setting to your personal server name. You can also create a text file which displays after the initial connection, and switch on Show After Login Message to enable it.
NETFile’s main strength is undoubtedly the easily configurable personal FTP server. In many ways the addition of the web server component is meant to be an adjunct to this – a simple server to provide alternative access to the content on your FTP site, rather than a dedicated web server.
That said, NETFile’s web server is actually pretty smart for simple home use. You set it up in almost exactly the same manner as the FTP server, with a few small differences. You don’t need to create an anonymous user profile as you did with the FTP server, since all connections are treated as anonymous anyway – this is an open web server after all. You can however create users and groups here, providing each with their own directory. You can even enable the Require Authentication button to require a password for entry to that directory using one of the specified user accounts. Switching to the Options tab in the HTTP server reveals much the same as you’d get with the FTP server we already configured. Again, it’s worth switching on Enable reverse DNS resolution for more meaningful log entries. The default setting for Maximum Connections is 64, and that’s way too high for a home broadband connection. You should drop this to no more than 10.
If you want to create a customised error page, which is displayed when a user attempts to access a page or directory which doesn’t exist, it’s simple to do. Create your page in your usual HTML editor, then browse to it in the Page Not Found (404) Page section of NETFile’s Settings pane. To sum up, NETFile’s web server is nowhere near as powerful or flexible as Apache – there’s no support for CGI scripting or server extension at all. On the positive side, it’s considerably easier to set up for quick sites, and you can have a server up and running in 10 minutes or less.


