Endolith
July 7th, 2008, 04:18 PM
On client machine, open two terminal windows.
In Terminal 1:
~> ssh server -X
Enter password
(Do it first in case you screw something up and lock yourself out, so you already have an SSH session open that you can fix it with.)
In Terminal 2 (client):
~/.ssh> ssh-keygen -t dsa
<Enter> for passphrase
<Enter> for passphrase
...
Your identification has been saved in /home/clientusername/.ssh/id_dsa.
Your public key has been saved in /home/clientusername/.ssh/id_dsa.pub.
...
~/.ssh> gedit ~/.ssh/id_dsa.pub
(Some tutorials say DSA and some say RSA. I'm assuming that DSA is better because it's newer.)
Back in Terminal 1 (server):
~> gedit ~/.ssh/authorized_keys
Copy and paste the key from one gedit window into the other, at the bottom of the list, if keys are already present.
(I initially tried copying the keys using nano, but it gave me buffer errors because the file wasn't formatted correctly. This method worked.)
Save and close gedit, then:
~> chmod 600 authorized_keys
I did this on both machines, and can now ssh from each to the other without a password.
If I ssh from another machine to either of these, I will still need the password, right? The keys are a machine-to-machine connection, and not a user-based thing.
If I copy the key to another machine, I can log in from that one without a password, but it would be better for security purposes to create a separate key for each machine, so I can cut one off if it gets compromised?
In Terminal 1:
~> ssh server -X
Enter password
(Do it first in case you screw something up and lock yourself out, so you already have an SSH session open that you can fix it with.)
In Terminal 2 (client):
~/.ssh> ssh-keygen -t dsa
<Enter> for passphrase
<Enter> for passphrase
...
Your identification has been saved in /home/clientusername/.ssh/id_dsa.
Your public key has been saved in /home/clientusername/.ssh/id_dsa.pub.
...
~/.ssh> gedit ~/.ssh/id_dsa.pub
(Some tutorials say DSA and some say RSA. I'm assuming that DSA is better because it's newer.)
Back in Terminal 1 (server):
~> gedit ~/.ssh/authorized_keys
Copy and paste the key from one gedit window into the other, at the bottom of the list, if keys are already present.
(I initially tried copying the keys using nano, but it gave me buffer errors because the file wasn't formatted correctly. This method worked.)
Save and close gedit, then:
~> chmod 600 authorized_keys
I did this on both machines, and can now ssh from each to the other without a password.
If I ssh from another machine to either of these, I will still need the password, right? The keys are a machine-to-machine connection, and not a user-based thing.
If I copy the key to another machine, I can log in from that one without a password, but it would be better for security purposes to create a separate key for each machine, so I can cut one off if it gets compromised?