Skip to content

Instantly share code, notes, and snippets.

@zecar
Last active May 17, 2024 07:18
Show Gist options
  • Save zecar/f04b1abd10c832120e3ff1b01b066e56 to your computer and use it in GitHub Desktop.
Save zecar/f04b1abd10c832120e3ff1b01b066e56 to your computer and use it in GitHub Desktop.
----- CREATE KEY --------
ssh-keygen -t rsa
ssh user@host mkdir -p .ssh // in case it's not there
cat .ssh/id_rsa.pub | ssh user@host 'cat >> .ssh/authorized_keys'
------ IN ~/sl.sh ----------
#!/bin/zsh
ALIAS=$1
declare -A ALIASES
ALIASES[vps]="ssh user@host"
if ! [[ $ALIASES[$ALIAS] ]]; then
echo "no alias found"
exit 1
fi
eval ${ALIASES[${ALIAS}]}
---------IN ~/.zshrc---------
alias sl="zsh ~/sl.sh"
--------- AFTER ALL THIS --------
source ~/.zshrc
after that you just type
sl myVPS
@zecar
Copy link
Author

zecar commented May 17, 2024

ALIASES[vps]="ssh root@152.228.162.142"
ALIASES[ep]="ssh ubuntu@135.125.233.29"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment