How To Use FTP For Web Development

FTP stands for File Transfer Protocol. This is one way to connect one a client computer to a server on a network. This gives you the ability to transfer files between the two without a physical connection.

FTP connection are the number one way to transfer files to your web hosting server. There are different types of connections and authorization modes that can be used. Each one has their different uses.

FTP Communication Passive & Extended

How To Use FTP

There are two different modes that FTP can use for communication.

Passive mode, which is when the FTP server will create a TCP connection with a random port. Then send your files to port 21 on the server.

Extended passive mode is when the FTP server will use the same setup and open a random port for the client. The difference is with extended mode, it will only transmit information through one port. Instead of using multiple ports.

The passive modes are always a connection from the client to the server. Where you can use an active mode, where the roles are flipped. The server connects to the client. By doing this you could have some transfer problems with firewalls and gateways.

SSH File Transfer Protocol

Transferring Files

FTP connections can be configured for high security. There is the standard FTP connection or a secure file transfer protocol. This SFTP connection uses a secure shell protocol or SSH. One main different between the two is the default port. FTP will use port 21 to transfer information. In an SFTP connect it will use port 22 to transfer information.

When connecting with an SFTP it will leave a digital finger print of the computer that has connected to it. This can be an eye opener if you see a figure print that does not belong to you.

Transferring files through an SFTP is also more secure. By using the SSH connection, it encrypts both commands and data. This protects sensitive information like passwords.

Security Problems and Concerns

Security Problems

Security issues to be aware of when using a standard FTP connection.

  • Password files are sent in a text format. These text files are not decrypted.
  • Firewalls can cause problems. They can deny the connections incoming and outgoing.
  • Files can be lost. When saving or transferring files, be aware that FTPs can timeout and files can be lost or corrupted. Always make backups.
  • FTP clients react differently. When selecting an FTP client, try to one that fits your workflow. This is critical if you do a lot of updates and changes. Fighting with your FTP client is not a fun task.
  • Hard to track what has happened. It is really hard to track who or what has happened to the server in an FTP connection. The time stamps are not always correct.

Using FTP

Using FTP

Start with getting an easy to use FTP client. I use one called WinSCP. It is light weight, basic, and easy to use.

You will need information on three required elements. The host name, which can be a domain name or IP address. The user name and password of the FTP account.

Under the file protocol, you will have the option of SFTP or FTP. I recommend using the SFTP. There are some cases where you web hosting provider only supports FTP.

When you have those, just fill in the blanks and click Login.

Once you are connected you can navigate around your server with a simple file explorer. This gives you the ability to upload, download, or edit files on your server.

FTP Reply Code

You will run into some type of reply code in your FTP environment. It good to have a quick reference sheet to know what these codes mean. Knowing what they mean will help you quickly debug the problem and continue with your work.

100 Series - Request action is being initiated.

  • 110 - Restart marker replay.
  • 120 - Service ready in xxx minutes.
  • 125 - Data connection already open; transfer starting.
  • 150 - File status okay; about to open data connection.

200 Series - Success reply.

  • 202 - Command not implemented, superfluous at this site.
  • 211 - System status, or system help reply.
  • 212 - Directory status.
  • 213 - File status.
  • 214 - Help message.
  • 215 - NAME system type.
  • 220 - Service ready for new user.
  • 221 - Service closing control connection.
  • 225 - Data connection open; no transfer in progress.
  • 226 - Closing data connection.
  • 227 - Entering passive mode.
  • 228 - Entering long passive mode.
  • 229 - Entering extended passive mode.
  • 230 - User logged in, proceed.
  • 231 - User logged out, service terminated.
  • 232 - Logout command noted.
  • 234 - Specifies that the server accepts the authentication.
  • 250 - Requested file action okay, completed.
  • 257 - "PATHNAME" created.

300 Series - Command accepted, but request action is on hold.

  • 331 - User name okay, need password.
  • 332 - Need account for login.
  • 350 - Requested file action pending further information.

400 Series - Command not accepted, request did not take place.

  • 421 - Service not available, closing control connection.
  • 425 - Can't open data connection.
  • 426 - Connection closed transfer aborted.
  • 430 - Invalid username or password.
  • 434 - Requested host unavailable.
  • 450 - Requested file action not taken.
  • 451 - Requested action aborted.
  • 452 - Requested action not taken.

500 Series - Syntax error, request did not take place.

  • 501 - Syntax error in parameters or arguments.
  • 502 - Command not implemented.
  • 503 - Bad sequence of commands.
  • 504 - Command not implemented for that parameter.
  • 530 - Not logged in.
  • 532 - Need account for storing files.
  • 534 - Could not connect to server - requires SSL.
  • 550 - Requested action not taken.
  • 551 - Page type unknown.
  • 552 - Requested file action aborted.
  • 553 - File name not allowed.

600 Series - Replies regarding confidentiality and integrity.

  • 631 - Integrity protected reply.
  • 632 - Confidentiality and integrity protected reply.
  • 633 - Confidentiality protected reply.

1000 Series - Common Winsock error codes.

  • 10054 - Connection reset by peer.
  • 10060 - Cannot connect to remote server.
  • 10061 - Cannot connect to remote server.
  • 10066 - Directory not empty.
  • 10068 - Too many users, server is full.

You Need To Learn FTP

FTP has its ups and downs and is easy to learn and use. It can make dynamic changes to a website and transfer files. It is a must to know when doing web development.

Advertisement

Share

Rating: 
5 (1 vote)

What Do You Think?

Copyright © 2017 https://www.webhostdesignpost.com