Connectivity
There are several prerequisites required for this library to function properly. In addition to the actual software installed on each host, the most critical step is establishing a key-based SSH connection between the two hosts.
Connectivity is only required in 1 direction, local
-> remote
; SSH/SCP connections will never be initiated from the remote
host.
Key-based SSH Connectivity
Consider 2 hosts, remote
and local
.
- From
local
, verify an SSH keys keypair exists. If not, create it.
local $ ls -la ~/.ssh/
- If there is no
~/.ssh/id_rsa
and~/.ssh/id_rsa.pub
, create them usingssh-keygen
.- If you are using a specific key-pair for each host, name your keys accordingly. For this example, the private and public keys will use the default names,
id_rsa
andid_rsa.pub
, respectively.
- If you are using a specific key-pair for each host, name your keys accordingly. For this example, the private and public keys will use the default names,
local $ ssh-keygen
- Now, copy the public key to the remote server. This is simple using the
ssh-copy-id
command, which comes withopenssh
on most distributions. Replace your user/remote hostname/public key path appropriately.
local $ ssh-copy-id -i ~/.ssh/id_rsa.pub user@remote
- At this point, you should be able to SSH to the remote server using only the private key, username, and hostname.
local $ ssh -i ~/.ssh/id_rsa user@remote
- (Optional) Add an SSH config entry
local $ vim ~/.ssh/config
# ...
Host remote
Hostname <IP or DNS name>
IdentityFile ~/.ssh/id_rsa
User <user>
# ...
1. Using this entry, you should be able to connect using only `ssh remote`