This blog post is how to connect to a server via the SFTP protocol, thus connecting to a server securely with SSH keys. The client create a SSH Public and Private Key. The Private Key gets sent to me. I use Cyberduck, which is free for Mac, to connect via SFTP Protocol.
Before you can connect with Cyberduck to the SFTP sever, you need to copy the Private Key in your Mac’s .ssh directory. This is a hidden directory. If it doesn’t exist then you need to create one. Lets first check if it exist via Terminal. Open terminal from Applications > Utilities > Terminal.
.ssh directory
- With a Terminal session open, make sure you are in your User/$Home directory.
- Type the following command to get a full directory listing.
ls -a
- Make sure the hidden directory .ssh exists. If it doesn’t you will need to create it with the
mkdir .ssh
command.
* You can also try TinkerTool, a nifty tool to let you see hidden directory in Finder.
Copy Private Key to .ssh directory
- Go to Finder by clicking anywhere on the Desktop
- On the menu, select Go to Folder and type ~/.ssh. This will open the window of the hidden .ssh directory.
- Copy the Private Key – id_rsa in the directory.
Configure Private Key with host from Terminal
- From the Terminal session, run the following command:
ssh username@local-ip-address
- The run the following command to get the right permission set to the Private Key
cd ~/.ssh
chmod 600 id_rsa
chmod 500 .
Connecting to the Server using the Key
- Open Cyberduck and click on Open Connection
- Select SFTP protocol from the drop down list
- Fill in the rest of the details to connect
There is a possibility that the host also need to set up a few settings on their side. For example, use your computer’s IP to give a specific computer permission to connect.
Leave a Reply