SSH - SCP - linux

Config File Location

/etc/ssh/sshd_config
sudo vim /etc/ssh/sshd_config
        

Generate SSH Key

# As per recommendation by GitHub
ssh-keygen -t ed25519 -C "your_email@example.com"

ssh-keygen -t rsa -b 4096
# -t is the algorithm and -b are the number of bits
        

Copy file from server

scp user@remote-host:path/to/remote/file.ext path/to/local/file.ext
        

Copy file to server

scp file.txt remote_username@10.10.0.2:/remote/directory
        

GitHub Not Recognizing Private SSH Key

By default, GitHub only looks for keys named id_rsa and id_rsa.pub
If you want to use a custom key name, use this command to pipe in a config for your custom name

cat >> ~/.ssh/config << END
Host github.com
    IdentityFile ~/.ssh/id_rsa.github
    User git
END

UPDATED:
# This seems to be a better way to ensure that appropriate keys are used.
# I struggled to use the above solution effectively

# Setting these aliases, or using the commands themselves tell your global git config which ssh key to use,
# thereby enabling both read and pass-protected write functionality at the flip of a switch (alias)
alias gitread="git config --global core.sshCommand 'ssh -i ~/.ssh/id_gh_read_only -F /dev/null'"
alias gitwrite="git config --global core.sshCommand 'ssh -i ~/.ssh/id_gh_write_read -F /dev/null'"

        

Generate SSH key without prompt

ssh-keygen -q -t rsa -N '' -f ~/.ssh/test/id_rsa <<<y >/dev/null 2>&1

-N new_passphrase provides the new passphrase.
-q                silence ssh-keygen.
-f filename       specifies the filename of the key file.

Then it pipes the output to null while supplying "y" to answer the prompts with a here string