CBKADAL
Week 02 Assignments 05
C. BinKadal --- Sendirian, Berhad.


Backup Your SSH and GPG Keys!

Genuine (ORI) Computer Science students back up their KEYS! Fake (KW) students keep sobbing because they are losing their keys.


Step 1: set the current week. E.g., for Week 02:

WEEK=02, or WEEK=03, or WEEK=04, etc.

WEEK=02

In another week, the number will obviously be different.


Step 2: Find your GnuPG ID. E.g.,:

gpg --list-key --keyid-format long



Step 3: Set your GnuPG ID. E.g., for CBKADAL:

KEYID=60914D29C01C81F1

Remember, you are not cbkadal!


Step 4: Set and list the “myBACKUP/” directory.

mkdir -pv $HOME/myBACKUP/
ls -al $HOME/myBACKUP/


Step 5: If necessary, copy or set all changed keys.

/bin/cp -vf $HOME/.ssh/id_ed25519     $HOME/myBACKUP/

/bin/cp -vf $HOME/.ssh/id_ed25519.pub $HOME/myBACKUP/

gpg --armor --yes --output $HOME/myBACKUP/mySECRETgnupgKEY.asc --export-secret-keys $KEYID

ls -al  $HOME/myBACKUP/


Step 6: Create a “PROOF” file for the WEEK.

pushd $HOME/myBACKUP/
rm -vf  WEEK??-MD5SUM.txt
md5sum id_ed25519 id_ed25519.pub mySECRETgnupgKEY.asc | tee WEEK$WEEK-MD5SUM.txt
ls -al
popd


Step 7: Copy the “PROOF file.

pushd $HOME/myBACKUP/
mkdir -pv $HOME/RESULT/W$WEEK/
cp -v WEEK$WEEK-MD5SUM.txt $HOME/RESULT/W$WEEK/
ls -al $HOME/RESULT/W$WEEK/
popd


Last Step: Save/Backup/Copy Your Keys Somewhere Else

It is highly recommended that you secure all the contents of the “myBACKUP/” folder to an external medium such as a flash drive.


WARNING

Never ever submit your files like “mySECRETgnupgKEY.asc” and “id_ed25519”!
By the way, keep a copy of those keys OUTSIDE your virtual guest!



© 2024-2024 --- C. BinKadal --- Revision: Mon 14 Oct 2024 13:00.