Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I would like to setup a basic FTP server on my Ubuntu Server install. I have been playing with VSFTPD, but am having issues getting the server to allow me to create directories and copy files. I have set the system to allow local users, but it appears that doesn't mean I get access to create directories. This may be an instance where I need to be better grounded in Ubuntu server setup in order to configure this FTP server adequately. The end goal is to be able to move files from my local dev folder into my www folder for deployment. Directories need to be able to move as well. Any help would be greatly appreciated.

share|improve this question
    
You mentioned moving files and folders form local dev to www folder - are you doing this all on the same machine or different machines? –  Marco Ceppi Aug 9 '10 at 0:51
    
Also are you complete sold with VSFTPD? Or would you be interested in other types of FTP softwares like pureftp? –  Marco Ceppi Aug 9 '10 at 0:52
    
Local dev is a separate machine altogether. I'm familiar with moving files to web servers via FTP, perhaps there is a better way. –  JPrescottSanders Aug 9 '10 at 1:04
    
I am not sold on VSFTPD, it was the first that I found while googling, if you have a simpler solution I'm all ears. –  JPrescottSanders Aug 9 '10 at 1:04
add comment

7 Answers

up vote 30 down vote accepted

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)

share|improve this answer
4  
PureFTP is the easiest to set up as far as I'm concerned. –  Nathan Osman Aug 9 '10 at 6:24
1  
You have an habit of giving complete explanation always like a teacher. Awesome!!! –  user3215 Mar 31 '11 at 8:02
    
I tried this but I can't connect with the newly created user. Existing users work fine –  wim Feb 2 '12 at 6:52
1  
This all works fine, except when I run the chsh this seems to prevent users from logging in via the FTP as well. Setting back to /bin/bash allows it to work again. –  DanH Aug 6 '13 at 3:36
1  
Thank you, and I can confirm I spent a full day with vsftpd and 5 minutes with pureftpd in setup time. For a simple setup, and secure, use pureftpd. I am confused why mainstream touts vsftpd! –  RyBolt Apr 6 at 14:19
add comment

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 :)

share|improve this answer
2  
hint hint... if you have Windows clients they can use WinSCP winscp.net/eng/index.php for accessing a sftp server. –  Source Lab Aug 9 '10 at 8:51
    
According to your comment the OP should of course use vsftpd, because vs stands for very secure. :-) –  qbi Aug 9 '10 at 10:47
    
PureFTPD uses the same authentication that SFTP does - its actually more secure in my opinion because if your account information is leaked then no one as SSH access to your machine. At worst they have File access. –  Marco Ceppi Aug 9 '10 at 13:47
    
+1 for SFTP over FTP –  n3rd Nov 8 '11 at 3:43
    
If your app only supports FTP, and you're tunneling it over SSH, what's the difference? :) –  endolith Mar 14 '12 at 21:46
add comment

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 qbi@127.0.0.1:~> 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 qbi@127.0.0.1:~> 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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
    
clear problem is the best answer :-) –  SjB Aug 11 '10 at 18:00
add comment

There are three different ways to set up an ftp server:

(1) Anonymous FTP :

People can access the server only with the anonymous account and without a password. Of course, the server administrator will set a limit for uploads to prevent users from putting illegal files like pirated music/films/games.

(2) FTP with both anonymous access and users with a passworded account:

This method lets both anonymous and passworded account users to enter the server. They will only have access to a specified directory, except for the user root who can view/modify/delete all files and/or folders.

(3) FTP with mysql support for virtual users authentication :

This method allows access to the server only for some user groups that haven't got a virtual users authentication shell account on the system. It uses an external mysql server that stores user information.

First Option : Anonymous FTP

Before starting the creation of an anonymous ftp server, you have to add a user called ftp into your system, with a home directory too. This step is really easy, just follow these commands:

useradd -d /home/ftp/ftp -s /bin/false ftp

mkdir -p /home/ftp/upload

Doing this permits only this account to write in this folder. You can use more variables to specify what the ftp server will do. Here are some examples:

-e Allow access to the server only by anonymous users
-B Start the server with background demon
-i Anonymous users can't upload files
-M Let anonymous users create folders
-s ftp user files cannot be downloaded

Second Option : '''Both anonymous and passworded account users'''

To make it possible to have both anonymous and passworded account users in the same server, follow this small guide :

-B ,-i ,M, -r, -s same of before
-u <uid> Enable users with a specified user id (uid) to access the server 
-V <Ip address> Only specified IPs will be able to access the server in non-anonymous mode 

Third Option : '''Virtual Users with Mysql'''

To create a server with mysql support follow this steps :

Download and install User Manager for PureFTPd which you can find here http://machiel.generaal.net/index.php?subject=user_manager_pureftpd

Decompress it and upload all its contents into your web server www directory and then write on your browser this link link http://localhost/ftp/install.php Follow all the steps that the installer asks to you Copy and save rge pureftpd-mysql.conf into pureftpd user manager directory

Done. Access to the administration panel using this link http://localhost/ftp

More options to add before launch the server process

-c <num> Max client that can connect to the server
-C <num> Max connections for a IP
-T <bandwitdh> Max bandwitdh disponible for each connection
-n <MBytes> Max MB that a user can have into its home folder
-m <Cpu Loading> Stops the anonymous uploads if the cpu loading exceed from this value 

And see this for some ftp server application:
https://help.ubuntu.com/6.06/ubuntu/serverguide/C/ftp-server.html

share|improve this answer
3  
When you copy and paste an answer from somewhere else, you should always credit the source. –  Dori Oct 16 '10 at 1:37
add comment

The default install of VSFTPD doesn't allow any create/modify changes by default. You need to edit /etc/vsftpd.conf and uncomment the following line...

write_enable=YES

And secondly you need to configure the appropriate file-system permissions on the respective files and folders.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.