So you now have your Ubuntu Server up and running with the help of "Installing Ubuntu Server 9.04" and you now have Samba working with the help of "Set up your new Ubuntu Server as a Samba Server". Now it's time to add ftp to the mix. Of course many people are of the mind set that FTP servers are slowly becoming a thing of the past. I would disagree because of the low cost of hardware, ease of set up, and ease of use. You can't beat an FTP server up on your network as a central file repository.
Now that you already have your Ubuntu Server up and running, adding FTP is actually quite easy. There are numerous FTP servers available, but the one I tend to prefer is vsftpd. Not only is it more secure than many other FTP servers, it's easy to install and configure, even for anonymous use.
In this article you will see how to get vsftpd installed and configured for both user login and anonymous use.
Since the installation for the base server is a GUI-less Ubuntu 9.04, the entire installation and configuration will be done from the command line. Log into your server and then issue the following command:
sudo apt-get install vsftpd
The above command will install everything needed for your FTP server. What you will find is your configuration file located in the /etc directory and the executable located in /etc/init.d/. By default vsftpd is installed to allow ONLY anonymous download. The default location for anonymous files is in /home/ftp. So by default all you need to do is place files you want to be accessible anonymously in /home/ftp, start the vsftp daemon with the command:
sudo /etc/init.d/vsftpd start
And you can immediately connect anonymously. Any file located within /home/ftp will be available to anonymous users. That's not a bad setup for an internal LAN. But if you need to control what people use/see, or if you do not want to allow anonymous access, you will have to take care of a little configuration.
Configuring user-authenticated login
Let's say you have four users on your system that need access to their own individual accounts. For this you will need to enable user-authenticated login. This is done within the /etc/vsftpd.conf file. Open up this file and scroll down to around line 26. Here you will see the entry:
Notice the "#" symbol at the beginning of the line? This means that line is commented out. Remove the "#" symbol, save the file, restart vsftpd, and now anyone with an account on your ftp server can log in with their username and password.
But what if the users need to upload as well as download? Simple. Below the local_enable line you will see the line:
Uncomment out that line and restart vsftpd to enable write access for your users. Remember, you have to restart vsftpd any time you make a change to the configuration file. You can also disable anonymous access by commenting out the line:
This can be handy for departments as well. Say you have an editorial department, a graphics department, and an accounting department. You will have to have those accounts added to the system. You can add those accounts (and their home directories) with these commands:
sudo useradd -m ACCOUNT_NAME
sudo passwd ACCOUNT_NAME
Where ACCOUNT_NAME is the name of the user account to create. The above commands will create the user, the users' home directory, and give the user a password.
Once these accounts have been created you can log into the FTP server with the username and password.
Setting up an FTP server couldn't be any easier. With the Ubuntu Server already up and running, you can have anonymous ftp set up in about a minute.Advertisement
Ghacks is a technology news blog that was founded in 2005 by Martin Brinkmann. It has since then become one of the most popular tech news sites on the Internet with five authors and regular contributions from freelance writers.