Well my dream of writing a lengthy blog post to really christen this new blog went slightly awry this weekend – we can put that down to a mixture of snow-related excitement and Godfatherly-related travels. Either way, I’ve only had time to put together this quick post regarding how to set up an FTP server on Linux using VSFTPD.
I should quickly note that setting up an FTP server is not something I do very often, there are probably better ways to do it, and there are probably better people out there to advise you how to do it. The fact that you’re still reading this though probably implies you’re not going to go to those other sources to get your FTP-related goodness, so here it is…
Setting up an FTP server couldn’t really be easier with VSFTPD and Ubuntu (I’m using Ubuntu 11.04 – Natty Narwhal), as you’ll hopefully agree!
Update your packages list
Always a useful step – make sure you’re working from the latest package list.
|
1 |
$ apt-get update |
Install VSFTPD
Well, it’s not going to work without it is it?
|
1 |
$ apt-get install vsftpd |
Configure VSFTPD
You weren’t going to get off that lightly, there is actually a little bit of work to be done! First, open up the VSFTPD config file with your chosen editor (mine’s nano).
|
1 |
$ nano -w /etc/vsftpd.conf |
First, make sure anonymous access is turned off by making sure the line reading the following is neither commented out nor has “YES” as the setting (if so, it should read as follows):
|
1 |
anonymous_enable=NO |
Rather appropriately, the next part allows local users to log in:
|
1 |
local_enable=YES |
And finally, if you wish to let users modify files change the line for allowing write access to read:
|
1 |
write_enable=YES |
Set up your users
In the simplest form of this setup the user’s home directory is what you see when you log in via FTP, therefore you can either create a new user and have their home directory (default is /home/username) as follows:
|
1 |
$ useradd -m ftpuser |
or specify a directory that you’ve created to act as the user’s home directory with:
|
1 |
$ useradd -d /path/to/home_directory ftpuser |
once you’ve added you need to create and confirm a password for the user with:
|
1 |
$ passwd ftpuser |
Only one thing left to do…
Now you can restart the vsftpd service with the following command and test your new FTP server!
|
1 |
$ service vsftpd restart |
Oh mighty lord Charlie, will this enable SFTP for me? Can I disable FTP and enable SFTP instead?
P.S. do you want a sudo with that?
Haha, good spot, yes, need to be either root or sudo all your commands.
Post regarding configuration for SFTP coming soon…
Pingback: Configure VSFTPD for SFTP connections using OpenSSL on Ubuntu
Hi, Im not sure if this would help you or not but I have written a guide about how you can do this with pureftp on ubuntu server 12.04. You can set up different accounts which you can manage through mysql. As i said, im not sure if this is you wanted but I hope it helps
http://wilson18.com/how-to/linux-networking/how-to-add-ftp-accounts-for-your-hosted-sites/