Install SSH Locally
1
Install SSH tools, if lacking
2
Generate an SSH keypair
3
PRO TIP: Create an SSH config file
Step 1.
Install SSH tools, if lacking
Mac and Linux computers come with SSH tools already installed.
If you're running Windows, and you do not have SSH, you have two options:
​
A. Install Windows OpenSSH Client.
The OpenSSH client can be installed using Windows Settings on Windows Server 2019 and Windows 10 devices.
To install the OpenSSH client:
1. Open Settings, select Apps > Apps & Features, then select Optional Features.
​
2. Scan the list to see if the OpenSSH client is already installed. If not, at the top of the page, select Add a feature, find OpenSSH Client, then click Install.
Once setup completes, return to Apps > Apps & Features and Optional Features and you should see OpenSSH listed.
B. Install Putty
Step 2.
Generate an SSH key pair
An SSH keypair consists of a private key file and a public key file, stored by default in your ~/.ssh/ directory, which must be readable/writable only by you.
​
PLEASE NOTE:
If you already have an SSH keypair, and wish to reuse your public key (not recommended), you do not need to complete this step.
To generate a new SSH keypair, open a terminal and execute the following commands:
> mkdir ~/.ssh
> chmod 700 ~/.ssh
> ssh-keygen -t rsa -b 4096
Hit [Enter] at each prompt to accept defaults.
​
After all that, it will create two files, e.g.
~/.ssh/id_rsa
~/.ssh/id_rsa.pub
​
NOTE: the private key file must have the appropriate permissions to work. It must be readable by you alone.
​
If your private key has different permissions, change via the file manager, or, in a terminal:
> chmod 600 ~/.ssh/id_rsa
​
​
Click here for more information
​
Step 3.
PRO TIP: Create an SSH config file
If you have many key pairs, or you just want to take advantage of some syntactic sugar, create an ssh config file. This creates basically named shortcuts to reduce the amount you need to type on the command line.
In your favorite editor, paste something like the following:
Host mybucket
HostName sftp.mybucket.org
User my-username
IdentityFile path_to_my_private_key_file
And save to:
~/.ssh/config
Then you can do things like:
> sfp mybucket
And it will infer the correct host, username, and key. This also comes in handy when using other tools.
​
Click here for more information
​