File Transfer Protocol (FTP) is a standard network protocol
used to transfer files from one host to another over a TCP-based
network, such as the Internet. Its most common use is uploading your website files to your webserver, allowing you to develop your website, upload it via FTP then refresh the page to see the updated page. If you’re setting up your own webservers its essential you have some way of uploading files and the best way to do this is with FTP. First you need to setup and configure an ftp server on your webserver, in this tutorial we are going to be using ProFTP. ProFTPD is a proven, high-performance and scalable FTP server, with a focus toward simplicity, security, and ease of configuration.
I’ve gone through many FTP server tutorials in the past and they all work fine for uploading to your home directory but in this situation we don’t want to just upload to our home directors, we want to upload to our website directors, in this case /var/wwwr. First off we need to setup a new user for our ftp login details:
Now we need to add the www-data group so it can write to you webserver storage, be warned this will set the users primary group to www-data so ensure you have created a new user especially for use as an ftp account.
Now in most situations your website is stored in /var/www, this often restricts writing from the www-data group so we need to change the permissions to allow any user in the www-data group to write to the /var/www folder:
Now we are ready to actually install the server, simply type:
Now we need to make some small configuration changes to ProFTP, first open then proftpd.conf file:
and edit the following lines to match my example,
Now we need to restart ProFTP so that it recognises the new settings:
and thats it your ftp server should be setup to allow you to upload, edit and download your website, to test this simply type in:
and enter your login details, now try making a folder with the following command
if you can do this with no errors that your ftp server has been correctly configured.
Trouble shooting
-----------------
1.. if you face permission problem during upload problem use following command
2... Use passive mode in file zilla and/or dreamweaver
I’ve gone through many FTP server tutorials in the past and they all work fine for uploading to your home directory but in this situation we don’t want to just upload to our home directors, we want to upload to our website directors, in this case /var/wwwr. First off we need to setup a new user for our ftp login details:
sudo useradd [username] sudo passwd [username]
Now we need to add the www-data group so it can write to you webserver storage, be warned this will set the users primary group to www-data so ensure you have created a new user especially for use as an ftp account.
sudo usermod -g www-data [username]
Now in most situations your website is stored in /var/www, this often restricts writing from the www-data group so we need to change the permissions to allow any user in the www-data group to write to the /var/www folder:
sudo chmod -R g+w /var/www
Now we are ready to actually install the server, simply type:
sudo apt-get install proftpd
and select the Stand Alone option when asked. Now we need to make some small configuration changes to ProFTP, first open then proftpd.conf file:
sudo nano /etc/proftpd/proftpd.conf
and edit the following lines to match my example,
# Use this to jail all users in their homes DefaultRoot /var/www # Set the user and group that the server normally runs at. User www-data Group www-data
Now we need to restart ProFTP so that it recognises the new settings:
sudo /etc/init.d/proftpd restart
and thats it your ftp server should be setup to allow you to upload, edit and download your website, to test this simply type in:
ftp 127.0.0.1
and enter your login details, now try making a folder with the following command
mkdir test
if you can do this with no errors that your ftp server has been correctly configured.
Trouble shooting
-----------------
1.. if you face permission problem during upload problem use following command
chown -R www-data:www-data /var/www
2... Use passive mode in file zilla and/or dreamweaver
No comments:
Post a Comment