Git & Linux SSH Script - devinziegler/Devin-Tech-Journal GitHub Wiki

Overview of Github

Github is a dynamic platform that can play many roles in many different contexts. My use of Github is this tech journal that takes the form of a wiki. As of recent I have started using Github for files and documentation for projects in SEC265. This entry will contain some commands and serve as a reminder and resource I can refer back to when doing future projects.

Getting Started With GIT

Installation on linux systems is simple, git can be installed using the following commands depending on distro and package manager:

  • RHEL
yum install git
  • Debian Based
yum install git

Git for windows can be installed here https://git-scm.com/download/win

Using GIT in the terminal

One of the first commands I had to use was git clone. This command clones a repository to the current directory:

git clone <repo_url>

If the repository is private, the username and password are required. However, I found that username and password authentication is no longer supported. Instead one should create a token through github and use it for login. This is not a problem on the windows GUI because it uses the web GUI to authenticate.

Adding to a repository is a simple task. When the changes are made and you wish to commit the changes use the following commands:

git add <edited_file>

git commit -m "comment for commit"

git push 

Syncing your local repo to the Github repo is done through pulling. You can also check the status of your local repository with the status command

git status
git pull

Sharing Public Keys

In this lab, we used Github to share the public key from our web01 system. This key is stored in the repo along with a script that will make a user, add the public key to the .ssh key directory allowing for passwordless ssh login from the web01 system. The script can be found in this repository, along with the public key for web01. I will also provide the link to the raw script below.

securessh-script (raw)

Future use of GIT in this class

Moving forward I see many uses for GIT. When faced with a new system in this class, I would normally have to set everything up manually. I would like to a make a sweet of scripts that I can use on any new machine once the system is networked. The first one I will tackle is going to be a user script. I will provide a link below:

User Creation Script

⚠️ **GitHub.com Fallback** ⚠️