when I connect with FTP using pem file it is connecting fine and by default, it is showing this directory: /home/ubuntu.

Now I am trying to change the /home/ubuntu directory to this: /var/www/myApplication. I am new to Linux can anyone tell which commands I need to use.!

and how can I see the default ftp path there is no vsftpd's folder/files in my etc folder


The ftp directory defaults to the user's HOME directory, so the easiest way to achieve your goal is to create a new user and set his HOME directory to /var/www/myApplication:

usermod -d /var/www/myApplication/ exampleuser

If you want to restrict the access to this directory you need to set


in your vsftpd.conf.

See Unix & Linux: How to create a FTP user with specific /dir/ access only on a Centos / linux installation

There may be an even simpler way, see here:

To change the default login directory for vsftpd, change the ftp user home directory in /etc/passwd: ftp:x:116:116:vsftpd daemon:/var/vsftpd:/bin/false

The ftp user (userID=116) home directory changed to /var/vsftpd. This will allow the default/anonymous/unknown user to land into a specific place(/var/vsftpd).


I am not really sure how you went about setting this up, but you need to install vsftpd.


  1. Install vsftpd:

    sudo apt-get install vsftpd
  2. Make backup of vsftpd.conf:

    sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.orig
  3. Setup firewall rules:

    sudo ufw allow 20/tcp
    sudo ufw allow 21/tcp
    sudo ufw allow 990/tcp
    sudo ufw allow 40000:50000/tcp
    sudo ufw status
    • Don't have firewall, then install:

      • sudo apt-get install ufw
      • Enable: sudo ufw enabe
  4. Create a user and make the home directory this /var/www/ftp/myApplication

    • create an additional folder called ftp as seen above in case you need to add more folders for other users.
    • Create user:

      sudo usermod -d /var/www/ftp/myApplication ftpuser
  5. Set its ownership, and be sure to remove write permissions with the following commands

    sudo chown nobody:nogroup /var/www/ftp
    sudo chmod a-w /var/www/ftp
  6. Assign ownership to the myApplication foler to user ftpuser

    sudo chown ftpuser:ftpuser /var/www/ftp/myApplication
  7. Setup /etc/vsftpd.conf add the following configurations:

    # Allow anonymous FTP? (Disabled by default).
    # Uncomment this to allow local users to log in.
    # Prevent the FTP-connected user from accessing any files or commands outside 
    # the directory tree
    # Add a user_sub_token in order to insert the username in our local_root directory 
    # path so our configuration will work for this user and any future users that might 
    # be added
    # Set up the configuration so that access is given to a user only when they 
    # are explicitly added to a list rather than by default
  8. Create and add user to the user_list:

    echo "ftpuser" | sudo tee -a /etc/vsftpd.userlist
  9. Restart daemon to load new configurations:

    sudo systemctl restart vsftpd



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.