Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
student:utilities:start:keypairs [2019/02/15 17:15] – bernstdh | student:utilities:start:keypairs [2024/04/03 18:11] – stewarmc | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | |||
===== Using SSH with a Key-Pair ===== | ===== Using SSH with a Key-Pair ===== | ||
- | Secure shell (i.e., '' | + | Secure shell (i.e., '' |
=== Checking for an Existing Key-Pair === | === Checking for an Existing Key-Pair === | ||
Line 30: | Line 29: | ||
=== Copying your Public Key to a Linux Server === | === Copying your Public Key to a Linux Server === | ||
- | On Linux servers, a user's public keys are stored in the file '' | + | On Linux servers, a user's public keys are stored in the file '' |
<code bash> | <code bash> | ||
cat id_rsa.pub >> ~/ | cat id_rsa.pub >> ~/ | ||
+ | </ | ||
+ | |||
+ | If the ~/.ssh directory does not exist you can create it. SSH has strict permission requirements on these files: | ||
+ | < | ||
+ | mkdir ~/.ssh | ||
+ | chmod 700 ~/.ssh | ||
+ | touch ~/ | ||
+ | chmod 600 ~/ | ||
</ | </ | ||
Line 39: | Line 46: | ||
At this point, you should be able to use SSH (either directly or indirectly) to login to the Linux server without providing an ID and/or password. | At this point, you should be able to use SSH (either directly or indirectly) to login to the Linux server without providing an ID and/or password. | ||
+ | |||
+ | === SSH Config File Example === | ||
+ | Below is an example ssh config file that on linux and mac would be located at '' | ||
+ | < | ||
+ | Host * | ||
+ | ServerAliveInterval 30 | ||
+ | ServerAliveCountMax 120 | ||
+ | AddKeysToAgent yes # https:// | ||
+ | IdentitiesOnly yes | ||
+ | Host github | ||
+ | | ||
+ | | ||
+ | Host stu | ||
+ | HostName stu.cs.jmu.edu | ||
+ | # next setting only necessary if you aren't using a default-named key like id_rsa or id_ed25519 | ||
+ | # IdentityFile ~/ | ||
+ | User stewarmc # if you specify a user, you don't have to put the user@ when connecting via ssh | ||
+ | Host aplaceicantreachdirectly | ||
+ | HostName internalonly.cs.jmu.edu | ||
+ | ProxyJump stu | ||
+ | ## some ssh servers may be listenign on a non-standard port. (the standard is 22) | ||
+ | # Port 23 # is typically for telnet, but people can do what they want with their servers | ||
+ | </ | ||
+ | |||
+ | Test the github one: | ||
+ | ssh -T git@github.com |