Hello Friends, Today we are going learn how to Setup FTP Server (vsftpd) on Google Cloud Compute Engine. Actually one of my client was asking for google cloud based ftp server but this thing was totally new for me and for that reason I had to do research on this and after 2 days finally I got the solution. And now when I have solution so I thought to share it. To Setup FTP server we just need to follow below steps:-
Step 1: create a virtual machine instance
after clicking create you will see your instance like below screenshot
Step 2: Connect to your instance through SSH by clicking on SSH
Step 3: Install ftp server (vsftpd) using below command
1 |
sudo apt-get install vsftpd |
Step 4: Configure FTP Server (vsftpd) by updating vsftpd.conf configuration file using below command
1 |
sudo nano /etc/vsftpd.conf |
the above command will open vsftpd.conf file in nano editor and then we need to do below changes in this configuration file.
Look for #write_enable=YES and uncomment by removing # sign to allow ftp users to write files to server.
Look for #chroot_local_user=YES and uncomment removing # sign to prevent users to browsing outside their own folder.
Look for #local_umask=022 and uncomment it by removing # sign to give correct permissions to uploaded files and folder.
Then we need to paste below line at the end of the file
1 2 3 4 5 6 7 8 |
#define your ftp directory local_root=/home/ftpuser #to allow upload in root directory allow_writeable_chroot=YES # passive mode min port number pasv_min_port=40000 # passive mode max port number pasv_max_port=50000 |
Step 5: Restart vsftpd and check status using below command
1 2 |
sudo systemctl restart vsftpd sudo systemctl status vsftpd |
Step 6: Create user and add ownership and permissions using below command
1 2 3 |
sudo adduser ftpuser sudo chown ftpuser /home/ftpuser sudo chmod 755 /home/ftpuser |
We will be asked to enter password while adding user, so we need enter password of our choice which will be used later to connect to ftp
Step 7: Update firewall rules to allow ports (20-21, 990, 40000 – 50000)
Step 8: Connecting to FTP Server
Step 9: Secure FTP with TLS (optional)
update vsftpd.conf configuration file to look for ssl_enable=NO and we’ll change it to ssl_enable=YES and we are done.
Thanks for stopping by
Please do share if you like it
Comments