Basic Ubuntu FTP Server

Solution 1:

I'm going to recommend PureFTPD because it's been the simplest and easiest to use in my opinion. You'll need to install it first: sudo apt-get install pure-ftpd once it's installed it'll start itself up. By default it uses PAM Authentications - meaning it uses the accounts which already exist on the system for it's auth. All you'll need to do is create a user account with the home directory being your www path and set the password for that account. You should then be able to connect with that user/pass combination to upload/download files.

Something like this:

sudo adduser ftpman --home /var/www/ --ingroup www-data

Which will create the ftpman user and put him in the www-data group which Apache uses and will walk you through the rest of the setup script. Once that's defined make sure to chmod the WWW folder if you get errors about it already existing to the user/group combination you created.

Lastly if you want to lock down SSH access for that account run: sudo chsh -s /bin/false ftpman which will change that users shell to false. (Replace ftpman with your ftp user)

Solution 2:

In my opinion SFTP is a better way to go. Hey, it's got the word "secure" in the name, it must be better :)

SFTP uses ssh to do file transfers (as distinct from FTPS, which is FTP + TLS, basically). What that means is that if you can ssh to the target machine, you can almost always SFTP to it, as it uses the same auth mechanisms, so no having to install and configure different server daemons at all (i.e. no pureftpd or vsftpd). As long as your permissions are set correctly for /var/www - which is probably a matter of sudo chmod g+w /var/www; sudo usermod -g $USER -G www-data $USER - you should be able to use SFTP immediately.

Most client software nowadays will do SFTP pretty happily, and you can also use scp from a shell on the dev server to copy stuff across (scp -R will copy entire folders across, and is very handy). You can even go another step and automate logins with public keys, meaning no more typing passwords :)

Solution 3:

I would strongly recommend using vsftpd. It is one of the most secure FTP daemons in Linux. Many others had weaknesses in the past and it seems the FTP is hard to implement in a secure way.

vsftpd starts right after you install it. Ubuntu enables local users to log in. So start your FTP client and log in as normal user with your system password (My example uses lftp):

> lftp 127.0.0.1 ftp
lftp 127.0.0.1:~> user qbi
Password: #typing my password which I also use to log in via GDM
lftp [email protected]:~> ls
drwxr-xr-x 10 1000 1000   4096 2008-07-28 16:32 Desktop
... many more

Now I'm using some kind of file manager (Nautilus, Shell etc.) to create a new directory foo and go back to my FTP client:

ftp [email protected]:~> ls -l
...
drwxr-xr-x 2 1000 1000   4096 2010-08-09 13:32 foo

Directory is there and I'm able to cd into it and use it. This is also the same if you have special users. There you can also create directories and they are immediately accessible. Here it is important to look for access rights.

Solution 4:

I humbly recommend an FTP server I wrote myself from scratch: JetFTP. It is extremely simple to install and use.


Installation:

  • Add my PPA to your software sources and update:

      sudo apt-add-repository ppa:george-edison55/george-edison
    
  • Run the following command:

      sudo apt-get install jetftp
    
  • That's it!


Using JetFTP is simple - just connect to port 8021 using a login name and password on the computer JetFTP is running on.

Solution 5:

Do not use ftp, it is an inherently insecure protocol because it sends the username and password in the clear to the server. Implementing sftp is just as easy and you gain a huge advantage in the security of your connection.