October 26, 2009

FTP (and it’s cousin, SFTP)

What is it?
From the techical side of things FTP stands for File Transfer Protocol. It’s just a fancy way of saying it’s a standard for transferring files between your computer and another computer, be it a web server, or just your friends pc. FTP isn’t something you generally need to worry about until you own a website, and then you’ll eventually realize that the file uploader that comes with your cPanel account by default just isn’t cutting it. When technical people refer to FTP they’re really saying FTP Program, which is a utility that you can install that can take advantage of the File Transfer Protocol and transfer some files from your PC to another one.

Do you have it?
ftpaccChances are, if you are the administrator of a server (even if it’s someplace you host your website online) you have access to FTP. Most hosting companies try to make it as easy as possible for people to set up their FTP accounts, and generally pouring through the help documents will ..well help. But if you log into your control panel (most likely cPanel) you can look for an icon that looks like this, or just says “FTP” on it
Setting it up
Essentially the page you are trying to get to will let you create and administer FTP accounts. The image below is what cPanel users will see. It’s a pretty straight forward form, and you just need to fill it out. The login is just the name that you will use to log in to your account. For my system, it’s set up to be login@feethavebeen.com, where “login” is a username that I created. The password is what you will need to enter to log in to your FTP account. Make sure it is something complicated, and if you’re not sure, just hit the Generate button and add a few characters onto the end. For some hosts, they automatically fill out the “Directory” setting. You should just delete this or set it to “public_html/”. That will ensure that the user you are logging in with can access all the files on your server. When you’re done just click the “Create FTP Account” button and wait for everything to be done. You’ll generally get to a confirmation page that will show you the username and password that you selected. Make sure you either write them down somewhere or remember them.

ftpaccsetup

Accessing your account
Now that your account is created, the next step is accessing your server using that account information. To do this you have a couple of options. IE users can log in through their browser by going to ftp://www.yoursite.com and then logging in using their username/password combination. That’s fine for downloading files, but when you want to start uploading them, I’d recommend and actual FTP client such as one of the following:

http://www.smartftp.com/
http://winscp.net/eng/index.php
http://fireftp.mozdev.org/ -   Firefox Addon Only
http://filezilla-project.org/ – Supports both SFTP, FTPS and FTP

You can download and install the FTP client and start it up. Generally when the clients start up they ask you for your account information to log in. You can set the host as your website, the username as the username you gave in the form, and the password that’s associated to it. Make sure that the PORT is set at 21. FTP utilizes port 21 to perform it’s functions. By default winSCP is set to PORT 22 (more on this in a second). Once that’s done, you can sign in to your ftp account.

Using FTP
Using FTP through one of the clients is very simple. You are normally presented with a split view. The files on your computer are on the left, and the files on your web server are on the right. To move files, you just drag them from your computer to the web server, or from the server to your computer. The files are then transferred over. There are many advanced functions that each FTP program offers, but that is something that is beyond the scope of this article.

SFTP?
By default, FTP transmissions are not encrypted. This means that your files and more importantly your passwords (thanks for pointing out that I missed this part Felipe) are passing in plain-text between you and your webserver. Most times this isn’t an issue, but if you are transferring sensitive data, or are just paranoid like me, you’ll want to use Secure FTP. Secure FTP encrypts all data that it transfers and therefore, is a little slower than standard FTP, but it is worth it (at least tome). Out of the FTP clients I mentioned, only winSCP can handle the SFTP. When using SFTP, you have to make sure that your PORT is at 22 instead of 21.

Comments (4)

  1. October 26, 2009
    felipe1982 said...

    >This means that your files are passing in plain-text between you and your webserver.
    Not important! What’s important is that YOUR PASSWORD TRAVELS IN THE CLEAR. I haven’t noticed any speed loss when using SFTP over the internet, but I have over a 100M or 1G LAN connection.

    Filezilla is the most popular windows FTP client, and supports SFTP (and FTPS)

    -felipe

  2. October 29, 2009
    xangelo said...

    Thanks for pointing that out felipe, I’ve updated the article to highlight this.

  3. November 2, 2009
    felipe1982 said...

    you da brotha

    • November 2, 2009
      felipe1982 said...

      should have been ‘you da man brotha’

Leave a Reply