Lab 03 Git & SSH Script - FlameSpyro/Tech-Journal GitHub Wiki
Overall most of this lab is pretty simple when it comes to the configuration of GitHub and git and enforcing from docker. I think it was really fun to set up this kind of connection. However, where I fall flat is the scripting part due to my little understanding of it, this will be explained later.
- Ensure you are in your user directory
cd /home/username
- ensure git is also installed
- Enter the following
git clone https://github.com/**github user**/Tech-Journal
- You will be prompted to enter your GitHub credentials
- A connection between docker-machine and GitHub has been made
- Within tech journal, make a directory called SYS265 and a directory inside that called docker01
- Move the following into the docker01 directory through copying
- 00-installer-config.yaml
- cloud.cfg
- docker-compose.yml
- hosts
- You can copy in ubuntu using
cp <source> <destination>
- Add, commit and push to your github through:
git add <file>
git status
git config user.email **email**
git config user.name **username**
git commit -m "message needed in order to push"
git push
- Recover lost files by using
git checkout <file>
- Download git on mgmt01
- Enter git clone command from step 3. Will be prompted to log in through a github login page
- Create an mgmt01 directory within SYS265
- Create file through
echo <hostname> >> README.md
- docker01 is now out of sync and needs to be fixed through
git pull
- Clone GitHub to web01 using clone command from part 1
- Within SYS265 of github create a directory like this
mkdir -p linux/{public-keys,centos7}
- Enter vi
centos7/secure-ssh.sh
to enter the following:#secure-ssh.sh
#author <username>
#creates new ssh user using $1 parameter
#adds a public key from the local repo or curled from the remote repo
#removes roots ability to ssh in
echo "ALL CODE GOES HERE"
chmod +x centos7/secure-ssh.sh
- Push changes to github
- Lets do a RSA keypair by starting with
ssh-keygen -t rsa -C "sys265"
- Hit enter when prompted o enter a file where to save the key
- Enter nothing for the passphrase aswell
- public key has been saved to a file called "id_rsa.pub"
- Push this key to guthub but ensure the private key isnt included or else the sun will explode
- Finish here when scripting problem is resolved
STATUS: UNSOLVED As of the time of writing this, the scripting is running into some errors due to my inability to write scripts. I will be reaching out to the professor to have this resolved and understood. When fixed, the guide will be wrapped up.
This lab is fairly simple if you know where your directories are. I find the concept of updating github from a command prompt to be both fun and interesting. My struggle/weakness in this lab comes to the cripting part. I am not good at scripting to come up with scripts on my own and need to practice more through external sources.