Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
student:utilities:start:keypairs [2023/09/13 10:40] – Typos morrispjstudent:utilities:start:keypairs [2024/04/12 11:29] (current) stewarmc
Line 33: Line 33:
 <code bash> <code bash>
 cat id_rsa.pub >> ~/.ssh/authorized_keys cat id_rsa.pub >> ~/.ssh/authorized_keys
 +</code>
 +
 +If the ~/.ssh directory does not exist you can create it. SSH has strict permission requirements on these files:
 +<code>
 +mkdir ~/.ssh
 +chmod 700 ~/.ssh
 +touch ~/.ssh/authorized_keys
 +chmod 600 ~/.ssh/authorized_keys
 </code> </code>
  
Line 38: 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 ''%%~/.ssh/config%%''
 +<code>
 +Host *
 + ServerAliveInterval 30
 + ServerAliveCountMax 120
 + AddKeysToAgent yes # https://man.openbsd.org/ssh_config#AddKeysToAgent
 + IdentitiesOnly yes
 +Host github.com
 +       IdentityFile /Users/tgm/.ssh/githubta
 +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 ~/.ssh/fac.cs.jmu.edu
 + 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 
 +</code>
 +
 +Test the github one:
 +ssh -T git@github.com