One of the most common tasks that a website owner will do is upload one or more files to their site. While it is a simple task, there are many ways to go about accomplishing it, each with their own quirks and best practices.
FTP (File Transfer Protocol) is probably the most popular method of uploading files to a server. A wide array of FTP clients exist for nearly every platform. Once configured, uploading a file can be as easy as dragging and dropping the file into the FTP client. Keep these in mind when configuring one:
- By default, FTP is an insecure protocol. The password for your FTP account is sent over in clear text, unencrypted. To best secure your server, FTP should not be setup with default settings.
- SFTP (Secure FTP) is the best way to secure your FTP. SFTP runs FTP over SSH (Secure Shell), which encrypts and secures the entire connection.
- SFTP requires a Linux user on the server. Because SSH requires a Linux user, SFTP only works for FTP accounts that are associated with a Linux user. If you are a cPanel user, this means that only one of the FTP accounts on a cPanel account will be able to connect via SFTP.
While FTP is the most common method of uploading a file, there are two command-line methods that are useful in certain situations.
If you are familiar with cp on the command line, you will find that scp works much the same:
user@workstation ~> scp webpage.html firstname.lastname@example.org:/home/user/domainx/public_html/webpage.html
scp securely copies a file from one machine to another over SSH. If you have previously set up passphraseless ssh keys you can avoid having to type in the ssh password. Otherwise, it will prompt you for the password of the Linux user on the server. For more information on setting up scp, see this knowledge base article.
Something to note about this method is that if the file upload fails for some reason, the entire file will need to be uploaded again. For small files, this is not usually a hassle. If you are 3Gb through a 4Gb file, however, that can add much time to a file upload. For large file uploads, it might be better to go with:
When rsync copies files, it first checks the differences between the file being copied from and the file being copied to. It then sends only those differences to the server, using less bandwidth and time than it would take to copy the entire file over.
For a more detailed look at rsync, check out this Liquid Web Knowledge Base post on rsync.
Our Sales and Support teams are available 24 hours by phone or e-mail to assist.