set ftp server in amazon ec2
1. login in putty
2. install vsftpd
sudo apt-get install vsftpd
sudo yum install vsftpd
3. Open up the FTP ports on your EC2 instance
Next, you'll need to open up the FTP ports on your EC2 server. Log in to the AWS EC2 Management Console and select Security Groups from the navigation tree on the left. Select the security group assigned to your EC2 instance. Select the Inbound tab and add port range 20-21, Also add port range 1024-1048 and set source to anywhere
4. Make updates to the vsftpd.conf file
Edit your vsftpd conf file by typing:
sudo nano /etc/vsftpd.conf
Disable anonymous FTP by changing this line:
anonymous_enable=YES
to
anonymous_enable=NO
Then add the following lines to the bottom of the vsftpd.conf file:
pasv_enable=YES
pasv_min_port=1024
pasv_max_port=1048
pasv_address=<Public IP of your instance>
5. Restart vsftpd
Restart vsftpd by typing:
sudo /etc/init.d/vsftpd restart
6. add a new user
sudo adduser username and follow steps to set password
7. Restricting users to their home directories
At this point, your FTP users are not restricted to their home directories. That's not very secure, but we can fix it pretty easily.
Edit your vsftpd conf file again by typing:
sudo nano /etc/vsftpd/vsftpd.conf
Un-comment out the line:
chroot_local_user=YES
Restart the vsftpd server again like so:
sudo /etc/init.d/vsftpd restart
8. To change the default FTP upload folder
Edit
edit /etc/vsftpd/vsftpd.conf
Create a new entry at the bottom of the page:
local_root=/var/www/html
To apply read, write, delete permission to the files under folder so that you can manage using a FTP device
sudo find /var/www/html -type d -exec chmod 755 {} \;
9. *in putty giving read, write, excute permission to file
sudo chmod 777 filename
*change filename
sudo mv oldFileName NewFileName
*delete file
sudo rm filename
*let user upload file to ftp server
sudo chown -R root:alex /home/ftp/alex
*export database via putty
mysqldump -p -u username database_name > dbname.sql
*delete whole foler
sudo rm -r foldername