Lab 03: Git Linux SSH Script - squatchulator/Tech-Journal GitHub Wiki

Lab 03: Git + Linux SSH Script

  • For this project we use a looooot of Git syntax. This is all essentially burned into my brain from my 2 years in the Game Program here at Champlain, so I figured it would be pretty redundant to include all the syntax of cloning and pulling and fetching here. Getting this script to work properly was super time consuming for me. I think the issue I kept running into is rather than using the Github public key that we had uploaded and generated from Web01, I wanted to go the route of making a new keypair and copying it over to the client via the script, which was very hard to get working. Manually making the keypairs worked so I was unsure what the issue was until I adjusted my script to use the repo pubkey and adjusted the permissions of the authorized_keys file, and I was able to get it working!

Setting up passwordless SSH

  • First, on the client system, navigate to the .ssh folder in your user directory. If it doesn't exist, create it.
  • Run the command ssh-keygen -t rsa to create a new keypair on the client. Hit enter until it creates it (so basically leave everything blank)
  • Now, it's as easy as copying over the SSH key(s) to the server with the command ssh-copy-id user@remotehost. Test it out, and it should let you SSH into that server with no password prompt!