New Access Method
This tutorial is a step-by-step guide for getting your Mac to transfer files to a server system in the most secure and reliable way…without being too obnoxious.
This involves an technique called Public-key cryptography (technically called asymmetric cryptography), where you have a private key on your computer, and a public key on the server. Only the person in possession of the private key can authenticate itself to the server.
Think of your private key as an actual key and your public key as the locks you place on your servers. To access my server, you would send me your public key for me to place as the lock on your account.
To set this up, just follow these three steps.
Step 1. Create an SSH Key
To begin, you need to create both a private and a public key. I’m
afraid that the simplest way to create both of these is to open
Terminal, and type the command:
Note: If you computer runs the risk of being stolen, ignore my advice and enter a passphrase (password) to protect your key.
Step 2. Email me the Public Key
In an email to me, click the Attachments button, and go to your home directory, which would most likely be your name. In this screen shot, I would click on howard.
The folder we want is hidden, so to show this, hit the magic sequence: Command and Shift and then the period. Scroll down…
You should be able to see a folder called
.ssh (Notice the initial
period). Double-click on that, and then double-click on the
id_rsa.pub (the one with the .pub ending):
If you tell me the exact directory that contains your web site files, then I may be able to give you a magic program that automatically copy the site to my server.
Either way, when I get the public key, I will use it to place a lock on your account, and I’ll let you know when you are ready for the next steps…
Step 3. Use an SCP Program, like Cyberduck
Once the lock is in place, you just need to use a good file transfer
tool to copy your files (like your web site) to my server. This
SFTP (also called SSH).
For this example, I will be using Cyberduck. To transfer files, you will grab files from Finder and drag them to the Cyberduck window to copy them to the server.
When you first start it, go to the Cyberduck menu, and select Preferences and change the Default protocol to SFTP:
Now, click the + button at the bottom left corner to create a new connection. Fill in the form to match this:
I will give you the values for both the Username (see #1) and Path (see #2) in the image above, as these are values on the server.