Chapter 5. Setting up FTP Access

Before you start this chapter

  1. Connect to your server over SFTP using FileZilla (see Chapter 2, Connecting to your server with FileZilla and SFTP).
  2. Set up a website (see Chapter 3, Website setup).

Fast forwarding to the scenario where you have a web hosting client who has designed their own site and would like to upload it themselves. However it is not necessary to grant them access to all domains on the machine, or even the config or mailboxes section of their own domain.

This is typical for a shared hosting client, and the solution is to give them FTP access. This limits them to the files inside the public/ directory, i.e. only those associated with the website.

In this example, access to the content of the my-brilliant-site.com site is being given to another user, but they are only to have access to /srv/my-brilliant-site.com/public/. To set this up, an FTP password is being created.

  1. Connect to your machine using FileZilla.

  2. Navigate to /srv/my-brilliant-site.com/config/

  3. Create a file ftp-password a that contains a secure password your shared hosting client will use, ensure that the config directory is selected b and upload the file, c. Make sure that there is no txt extension on this file.

Now that is all that is needed. Access to the machine can now be granted over FTP using the username my-brilliant-site.com and the password being the contents of /srv/my-brilliant-site.com/config/ftp-password.

We will now test the connection to make sure it works, also using FileZilla, since it can be used to connect via FTP as well as SFTP.

  1. Make sure FileZilla has disconnected from the machine.

  2. The host a and the user b are both the domain name, in this case my-brilliant-site.com. The password c is the contents of the ftp-password file and for FTP the port number must be set to 21, d.

  3. Once you connect you’ll notice that you only have access to directories beneath the public directory (here represented as "/") of the my-brilliant-site.com directory tree, which is all you’d need if your role was limited to maintaining or setting up a web site.

Note

If you created a sub domain such as fantastic.my-brilliant-site.com, for FTP access the user would be fantastic.my-brilliant-site.com as you might expect, but the host would be the domain, not the sub domain, in this case my-brilliant-site.com