Knowledgebase

What is (FTP) File Transfer Protocol? Print

  • 54

Introduction Are you wondering what FTP is and how you can use it to upload/files from your site quickly and easily? Would you like to know how to set permissions on files and folders? If so, then this tutorial is for you.



I know some of you may be convinced that you have sufficient tools to upload and download files using your built in FTP client in your HTML editor, but I will show you an example of a freeware FTP client that will give you more control over the advanced features of your site, allowing you to upload and install scripts properly, rather than just uploading HTML files.

Please note: This permissions tutorial applies to Linux-based servers only and although Windows does have a permission system, it's different and cannot be set by anyone using an FTP client.

What is FTP?

FTP stands for File Transfer Protocol. In easy to understand terms, FTP is the way that computers talk to each other to transfer files. It's quicker than transferring a file by email or on a disk. It's direct access to the space that you are transferring files to.

Ok, so how do we get connected in order to transfer files using FTP? Good question. We need a 'client' or a browser that speaks 'FTP'. We need an FTP client.

Getting an FTP client

There are tons of FTP clients out there, and some are even built into your HTML editors to allow you to upload your files to your web space. Most of these only transfer files to and from the space that you are connected to. While, in most cases, this is sufficient for updating the content of a website, they just don't cut it as far as I'm concerned.
You need something that will allow you to change permissions at the very least. When you start to get a little more involved you might want to explore some FTP commands and also use SFTP or SSH (Secure FTP or encrypted connections).

I found FileZilla was a decent choice because it has the ability to allow you to grow a little. You can download a copy from the current project page for free at http://filezilla.sourceforge.net/

Connecting to your website

In order to connect to a web site using FTP, you must have 3 things: A server/FTP address, a username and a password.
This will then connect you to the folder on the computer that the username is allowed to access. This will usually be where your website domain is pointing when you view it from a browser.



To connect using FileZilla, you can simply use the quick connect bar at the top of the program to enter your FTP server address, username and password. Don't worry about the port number, it simply defaults to 21. If you must use a specific port for FTP then you can enter it there.



Once you are connected you should see a list of files (if there are any) or folders in your remote directory listing. Sometimes you will connect just outside your viewable website folder which might be public_html, www, htdocs or httpdocs. If you don't know where your viewable website folder is, then you should ask your host – just email them and say something like "Look, I'm new to using FTP, and I need to know which folder my website is stored in so I can upload files to my site". That should be enough for them to tell you where it is.

Another way to see where your viewable folder might be is to check the email that was sent to you by your host when you signed up. If you were able to get the FTP details, then you might see a path that contains your website directory. Eg. /home/www/username/public_html. The last thing to remember about your viewable website directory is that you cannot access it from your domain using the actual folder name. For example, if your domain is www.yourdomain.com and your website folder is "public_html", then you cannot access www.yourdomain.com/public_html because it is already pointing directly at the folder when you type www.yourdomain.com – you don't need to add the folder name on the end.

Here's an example site that I logged into using FileZilla.

Uploading and Downloading Files

If all is well and you have connected via FTP to your website directory, then you should be able to look on your local drive on your computer for a file that you want to place on your website. The best choice at this stage would be a normal HTML file that is already viewable locally within a browser. So instead of this address - C:Documents and SettingsUser1My Documentsmyhomepage.htm, you will upload the file and then access it from your domain name like this- http://www.yourdomain.com/myhomepage.htm

Upload a HTML file via FTP and you will be able to see it through your browser. You will have published a file that anyone on the Internet can see. The earlier diagram shows connecting to the same space using a browser and an FTP client.

What are file permissions? Why do we need them?

File permissions are necessary to protect and to instruct the server about how to handle certain files. They can be set using raw FTP commands, but the easiest way to set them is using an inbuilt tool from your FTP client. This is where some FTP clients do not support the changing of permissions on files. One good example is the built-in FTP client in Dreamweaver, which will only allow you to set permissions using a specific raw FTP command. If you have multiple files and folders to set permissions on, typing the FTP command multiple times would become tedious.

It is a good idea to become at least a little familiar with what permissions are used for what purpose. The reason for this is that most scripts will actually need certain permissions to run. If they are simply uploaded as normal by say, Dreamweaver, they will inherit 'normal' permissions by default, but it may not be suitable in order to actually 'run' or 'execute' the commands that are inside the script. Most default permissions will only allow you to read a file, which will unfortunately not be enough to run a script.
The most common permission required to run a script is CHMOD 755 (-rwx r-x r-x)

What's CHMOD?

CHMOD stands for Change Mode and simply means that you are changing your permissions on the file or folder. "CHMOD" is also a UNIX command that is used in code and through the command line to change permissions on files and folders.

For example, in PHP it's used like this: chmod("/path/to/filename", 0755);

Types of permissions for different user groups

There are three types of permissions to set on folders and files on UNIX servers – Read, Write and Execute permissions. There are three distinct groups that are affected with these permissions to allow you to control who has access to the file or folder.

These groups are as follows:
The owner of the file - usually whoever uploaded it, or whomever created it.
The group – usually other registered hosting users on the actual server or common resources that are setup to run under this permission group.
The public – this is the public or Internet user.

So each group has three settings or switches, to allow you to control their access based on whether you want them to read, write or execute the resource that you are setting permissions on. For example, you can allow the owner group to read and write to the files, while the group and public can only read.

Setting Permissions in FileZilla

FileZilla will allow you to change the file permissions or "attributes" as this program calls them, on files and folders. You can even choose multiple files and folders in the same window view to change multiple permissions at the same time.

Setting a file or folder permission in FileZilla is easy. You simply check the box to turn that setting on, like a switch. Select a file, then right click on it. A menu will appear and you will need to choose "File Attributes".



A popup will appear with options available for all permissions on each group. You simply have to check the boxes or enter the numbered permission that you require in the box provided.


Was this answer helpful?
« Back