These are notes for creating a one-way connection. For our purposes, the machine you are connecting from is referred to as the “local” machine, and the machine you are connecting to is referred to as the “remote” machine.
These steps work fine even if the usernames on the “local” and “remote” machines are different.
ssh-keygen -t dsa
onceid_dsa.pub
and a private key id_dsa
.Then make a copy of the public key with the “local” hostname, for example:
$ cp id_dsa.pub dev.id_dsa.pub
Copy the “local” public key to the “remote” ~/.ssh directory, one way or another. For example:
$ scp dev.id_dsa.pub nstilwell@test:~/.ssh
Now you see why we renamed the key? So as not to overwrite the “remote” machines public key, so we don
t get confused ;) I am unsure how important this is.
Append the public key from “local” to the end of ~/.ssh/authorized_keys on “remote”. For example:
$ cat dev.id_dsa.pub >> authorized_keys2
The ~/.ssh directories on both machines should be available (drwxr-xr-x):
$ chmod 755 ~/.ssh
Private keys and the authorized_keys2 file need to be private (-rw——):
"local" -> $ chmod 600 ~/.ssh/id_dsa
"remote" -> $ chmod 600 ~/.ssh/authorized_keys2