Skip to content

ssh

  • Create ssh key pair
Bash
ssh-keygen -t ed25519 -C some-name
  • Add or migrate existing ssh key
Bash
sudo chmod 400 id_ed25519
Bash
sudo chmod 400 id_ed25519.pub
Bash
eval `ssh-agent -s`
Bash
ssh-add id_ed25519
  • SSH tunneling

Let say some machine has access to certain domain or IP and you wanna access it from your machine

Bash
ssh -L local_port:remote_address:remote_port user@domain_or_ip

Access that port using curl or whatever for example curl http:127.0.0.1:local_port

Use tunnel to access mysql:

Bash
ssh -L 3306:mysql-server:3306 username@mysql-server