Skip to content

Instantly share code, notes, and snippets.

@Machou
Created January 14, 2023 22:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Machou/7cf39f12050890ea8842638247e94f0b to your computer and use it in GitHub Desktop.
Save Machou/7cf39f12050890ea8842638247e94f0b to your computer and use it in GitHub Desktop.

Aide-mémoire Bash

Se connecter à GitHub via SSH

On vérifie nos clés SSH :

  1. cd ~/.ssh && ls -alh

Si aucune clé n'est disponible, on génére une paire de clé :

  1. ssh-keygen -t ed25519 -C "github@domaine.com"

On ajoute la clé privé à l'agent SSH :

  1. eval "$(ssh-agent -s)"
  2. ssh-add ~/.ssh/id_ed25519_github

On se rend sur GitHub et on y ajoute la clé public.

  1. cat /.ssh/id_ed25519_github.pub

On teste la connection à GitHub :

  1. ssh -T git@github.com

Gestion des clés GPG

  1. Installer les dépendances

apt install apt-transport-https dirmngr --install-recommends

  1. Mettre à jour

apt update

  1. Afficher la liste des clés GPG

déprécié apt-key list

gpg --list-keys

gpg --list-packets cle.asc

gpg --with-fingerprint cle.asc

  1. Ajouter une clé GPG

gpg cle.asc

gpg--keyserver pgp.mit.edu --recv-key 6B73A36E6026DFCA

wget -O - https://deb.goaccess.io/gnugpg.key | gpg --dearmor | tee /usr/share/keyrings/goaccess.gpg >/dev/null
echo "deb [signed-by=/usr/share/keyrings/goaccess.gpg arch=$(dpkg --print-architecture)] https://deb.goaccess.io/ $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/goaccess.list
apt update
apt install goaccess
  1. Supprimer une clé

apt-key del 30C18A2B

Afficher la liste des IPs du serveur demandé

host pgp.mit.edu

Divers

Savoir si on est root

if [ whoami != root ]
then
	echo '[!] Vous n'êtes pas en root.'
	#exit
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment