<

Go Premium for a chance to win a PS4. Enter to Win

x

How to transfer Files on a Webserver to local machine via SSH

Published on
9,514 Points
3,514 Views
Last Modified:
We all know how boring and exhausting it is to transfer huge web projects developed locally to a webserver simply via FTP.

The File Transfer Protocol is a really nice solution if you need to transfer small amounts of files, but if you're planning to transfer your local development on your webserver via FTP it can take literally hours. For example a Joomla! installation package extracted on your local machine and transfered to the webdirectory where it's going to be installed takes more than ONE hour via the open source FTP client called Filezilla.

This is wasted time that you could have spent more productively going through the installation process, setting up a database connection for your project and have written your first articles in your blog or CMS.

There are several approaches to avoid long transfer time. I will go through one of them, where the good old FTP-client is still involved but where you will need an connection to your webserver via SSH (Secure Shell), another very useful and encrypted network protocol.

What you need:
Filezilla or similar FTP client
Terminal App on a Mac or the comand line on a Windows System

In our common scenario you likely have a local webserver installed where you already have a development of your webproject and what you need to do now is to create a zip file of the folder where your webproject resides.

How to compress files really depends on your operation system. A google search with "create zip file of folder in *your platform*" will give you the answer. On a Mac do a ctrl-click and then click on "compress *your folder name*". On a Windows PC do a right click on your webprojects folder and goto "Send To->Compressed (zipped) folder".

In the next step you need to connect via your FTP Client Filezilla or similar and transfer the file to the directory on the webserver. I won't be going through the process of how to connect to your webserver via FTP since this article is about ssh and there are plenty of well explained tutorials on how to do that. This saves up tranfer time but you still will have to unzip the file on the webserver, which isn't possible via FTP.

This is where the Comand line Tool (Terminal for Mac or Putty for Windows) comes in handy. I will show the whole process on a Mac within the Terminal Application. Don't worry if you're on a windows PC, the commands are the same for a windows command line tool.

1. Open a Terminal or Putty Application
Termianl Application on a Mac (colors may vary)2. Type the SSH comand
ssh username@ip-address

Open in new window

ssh command with username and ip address of the webserver to connect toLet me explain that a little more in depth. SSH tells the terminal to connect through that protocol. The protocol needs two pieces of information: the username on your webserver (It is the same you use to connect via FTP) and the ip-address of your webserver seperated by the @ symbol. Then press Enter on your keyboard.

3. The webserver will now be prompting for the password. Use the same as for your FTP connection. Don't worry if any character is shown after you've typed your password. This is a security feature of your terminal/command line application. It never shows passwords or dots as you may know it from a webform.
Type your password in here. No dots or the actual password will be shown while typing.4. Now you are connected to your webserver and have more power over your files than you have with an FTP connection. First you want to browse to the directory where your zip file lies. This can be done by the cd (change directory) command.
cd /path/to/your/webdirectory/

Open in new window

5. You are now in the directory where your zip file lies, now there is only one little tiny line of code which extracts your files back out into the directory where it is lying right now.
unzip yourzipfile.zip

Open in new window

unzip your zipfile and your done. Isn't it easy?
This is all. Now you've extracted the zip file on your webserver. The whole process should have taken you not more than 15 minutes. No more waiting for FTP to transfer your files. The zip compression of your files saved you bandwith and transfer time. Extracting files on your server is an easy process as you could see. Good luck!
0
Comment
Author:mcnute
0 Comments

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Join & Write a Comment

Viewers will learn how to properly install and use Secure Shell (SSH) to work on projects or homework remotely. Download Secure Shell: Follow basic installation instructions: Open Secure Shell and use "Quick Connect" to enter credentials includi…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Other articles by this author
Suggested Courses

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month