Cloudbooklet
  • News
  • Artificial Intelligence
  • Applications
  • Linux
No Result
View All Result
Cloudbooklet
  • News
  • Artificial Intelligence
  • Applications
  • Linux
No Result
View All Result
Cloudbooklet
No Result
View All Result
Home Google Cloud

Setup FTP on Google Cloud/AWS with VSFTP on Ubuntu 18.04

by Cloudbooklet
4 years ago
in Google Cloud, AWS
Setup Ftp On Google Cloud With Vsftp On Ubuntu 18.04
ShareTweetSendShare
Readers like you help support Cloudbooklet. When you make a purchase using links on our site, we may earn an affiliate commission.

Setup FTP on Google Cloud with VSFTP on Ubuntu 18.04. In this guide you are going to learn how to setup a FTP server and provide access to particular directory as chroot for a user. This setup is tested on Google Compute Engine VM Instance running Ubuntu 18.04 LTS. This post also works fine for […]

ADVERTISEMENT

Setup FTP on Google Cloud with VSFTP on Ubuntu 18.04. In this guide you are going to learn how to setup a FTP server and provide access to particular directory as chroot for a user.

This setup is tested on Google Compute Engine VM Instance running Ubuntu 18.04 LTS. This post also works fine for AWS EC2 Instance or DigitalOcean Droplet or Kamatera or Vultr or any other cloud hosting servers or VPS or Dedicated.

Prerequisites for Google Cloud

If you are using Google Cloud Platform to setup FTP you need the following steps to be done.

ADVERTISEMENT
  1. A running Compute Engine, see the Setting up Compute Engine Instance with Ubuntu 18.04.
  2. Completed the initial Ubuntu server setup.

Prerequisites for AWS

  1. A running EC2 Instance. Learn how to create an AWS EC2 instance.
  2. Assigned a Elastic IP to your EC2 Instance.
  3. Successful SSH connection to your EC2 Instance.

SSH to your EC2 Instance and perform the steps listed below.

Steps to setup FTP on Google Cloud/AWS

  1. Setup you Virtual Machine Instance
  2. Completing the initial server setup
  3. Configure Firewall rules
  4. Create a new user
  5. Install VSFTP FTP server
  6. Configure FTP
  7. Verify the setup

I assume you have your server setup and configured.

You might also like

How To Setup Ssh Keys On Ubuntu

How to Setup SSH Keys on Ubuntu 20.04

4 months ago
Draggan Ai Editing Tool Install And Use Draggan Photo Editor

DragGAN AI Editing Tool Install and Use DragGAN Photo Editor

4 months ago

Setup Firewall rules

You can configire FTP on any port you wish, now you will configure it in the default port 21, so you need to create a firewall rule to provide access to these ports.

ADVERTISEMENT

We also open ports 40000 – 50000 for passive mode connections.

Go to VPC Network >> Firewall rules and click Create Firewall rules.

ADVERTISEMENT

In Name enter ftp

In Targets select All instances in the network

ADVERTISEMENT

In Source filter select IP ranges

In Source IP ranges enter 0.0.0.0/0

ADVERTISEMENT

In Protocols and ports check TCP and enter 20, 21, 990, 40000-50000.

Click Create.

Allow FTP ports in UFW

If you are using UFW in your server make sure to open the port to allow connections to your server otherwise you cannot connect.

sudo ufw allow 20/tcp
sudo ufw allow 21/tcp
sudo ufw allow 990/tcp
sudo ufw allow 40000:50000/tcp

Create a new user

Now you can create a new user using the following command to test the FTP.

sudo useradd -m -c "Name, Role" -s /bin/bash username

Setup a password for that user.

sudo passwd username

Install VSFTP server

VSFTP is a Very Secure File Transfer Protocol for Linux based systems. By default AWS or Google Cloud won’t allow password based authentication to the Virtual Machine instances.

With VSFTP you can run your own FTP server and create users and assign them to any directory and prevent access to other directories using chroot also.

Now you can install VSFTP using the following command.

sudo apt install vsftpd

Once the installation is completed you can configure VSFTP.

Configure VSFTP

Start by creating a backup of the original VSFTP configuration file.

sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.orig

Edit the vsftpd.conf file and make the following changes.

sudo nano /etc/vsftpd.conf

Modify the following directives.

listen=YES
listen_ipv6=NO

Uncomment the following directives.

write_enable=YES
local_umask=022
chroot_local_user=YES

Add these configurations to the last.

seccomp_sandbox=NO
allow_writeable_chroot=YES
userlist_enable=YES
userlist_file=/etc/vsftpd.userlist
userlist_deny=NO
tcp_wrappers=YES
user_sub_token=$USER
user_config_dir=/etc/vsftpd/user_config_dir
pasv_min_port=40000
pasv_max_port=50000

Here you have configured a userlist_file which holds the list of FTP users and user_config_dir to hold the user specific configurations.

Add the user you have created before in the userlist file.

echo "username" | sudo tee -a /etc/vsftpd.userlist

This command will create a file with the name vsftpd.userlist and add the user to it and outputs the added user in the terminal.

Create a directory with the name user_config_dir to hold the user specific configurations.

sudo mkdir -p /etc/vsftpd/user_config_dir

Create a new file with the name same as the username inside this directory.

sudo nano /etc/vsftpd/user_config_dir/username

Add the following line to that file.

local_root=/path/to/your/directory

Save the file and exit the editor.

Finally restart VSFTP.

sudo systemctl restart vsftpd

Prevent SSH Access

Now you need to prevent SSH access to the newly created user by adding the DenyUsers directive in your sshd_config.

sudo nano /etc/ssh/sshd_config

Add the following line to the bottom of the file.

DenyUsers username other-user

You can add multiple users separated by a space.

Restart SSH.

sudo systemctl restart ssh

Prepare yourself for a role working as an Information Technology Professional with Linux operating system

Verify the Setup

Now open your FTP client and enter your server external IP address as hostname, Port as 21, username with the username you created before and with the password.

Now you will be logged in to the server and you can only access the folder that is assigned to you.

Conclusion

Now you have learned how to setup FTP on your VM instance on Google Cloud Platform.

Thanks for your time. If you face any problem or any feedback, please leave a comment below.

Tags: AWSEC2FTPGoogle Cloud PlatformUbuntu 18.04
Share1Tweet1SendShare
Cloudbooklet

Cloudbooklet

Comments 2

  1. Avatar Of Inno Inno says:
    3 years ago

    Thanks a lot for the descriptive guide.
    I have followed up till the “Go to VPC Network >> Firewall rules and click Create Firewall rules” section in the tutorial.
    It seems I can’t find the appropriate section in my AWS dashboard.
    Rather, this is what I have under my VPC dashboard:
    VPC – AWS Network Firewall – Firewalls; Firewall policies; Network Firewall rule groups.

    I seem not to be able to find the appropriate section:

    In Name enter ftp

    In Targets select All instances in the network

    In Source filter select IP ranges.

    However, I created a firewall and named it ftp. The challenge is that I can’t find any Targets to select all instances in the network.

    Any help pls?

    Reply
    • Avatar Of Cloudbooklet Cloudbooklet says:
      2 years ago

      In AWS you need add the rules in the Security Group

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Related Posts

Set Up Deep Learning With Nvidia, Cuda, Cudnn On Ubuntu

How to Set Up Deep Learning with Nvidia, CUDA, cuDNN on Ubuntu 22.04

7 months ago
How To Install Or Upgrade Php 8.2 On Ubuntu 22.04

How to Install or Upgrade PHP 8.2 on Ubuntu 22.04

9 months ago
How To Change Timezone On Ubuntu 22.04

How to Change Timezone on Ubuntu 22.04

1 year ago
How To Install Ansible On Ubuntu 22.04

How to Install Ansible on Ubuntu 22.04

1 year ago

Follow Us

Trending Articles

Ai Girl Generator

7 Best AI Girl Generators for Creating Realistic and Beautiful AI Girls

September 19, 2023

HeyGen AI: Free AI Video Generator to Create Amazing Videos

Microsoft Unveils New Disc-Less Xbox Series X with Lift-to-Wake Controller

How to Create and Customize Stunning Contact Poster on iPhone

Top 10 Advantages of a Cloud VPS Server

AI Annotation Jobs: Everything You Need to Know

Popular Articles

Ai Cover Song

6 Best AI Cover Song Generators for Free Online

September 13, 2023

Microsoft Bing AI Image Generator: How to Create Amazing Artworks with AI

Top 5 AI Jewellery Generators to Create Jewellery Designs

DreamGF – Best NSFW AI Website to Have Fun for FREE

7 Best AI Face Generator: Create Realistic Faces from Text Online Free

Notepad++ v8.5.7: What’s New and How to Download It

Subscribe Now

loader

Subscribe to our mailing list to receives daily updates!

Email Address*

Name

Cloudbooklet Logo

Welcome to our technology blog, where we explore the latest advancements in the field of artificial intelligence (AI) and how they are revolutionizing cloud computing. In this blog, we dive into the powerful capabilities of cloud platforms like Google Cloud Platform (GCP), Amazon Web Services (AWS), and Microsoft Azure, and how they are accelerating the adoption and deployment of AI solutions across various industries. Join us on this exciting journey as we explore the endless possibilities of AI and cloud computing.

  • About
  • Contact
  • Disclaimer
  • Privacy Policy

Cloudbooklet © 2023 All rights reserved.

No Result
View All Result
  • News
  • Artificial Intelligence
  • Applications
  • Linux

Cloudbooklet © 2023 All rights reserved.