Where to start First steps track · 15 stages
Linux Labs

ssh, scp — connecting and copying over SSH

cheat sheet · OpenSSH 9.6 https://lab.dimsanych.ru/en/wiki/ssh-client/

Cheat sheet

  • ssh user@host connect
  • ssh -p 2222 user@host non-default port
  • scp file user@host:/path/ copy a file to the server
  • ssh -L 8080:localhost:80 host local tunnel
  • ssh -J bastion host connect through a bastion
  • ssh-keygen -R host remove a stored host key

Options

To avoid repeating parameters, use host aliases in ~/.ssh/config:

Host web
    HostName 192.168.1.10
    User deploy
    Port 2222
    IdentityFile ~/.ssh/id_ed25519

Now just ssh web. Useful extras: ServerAliveInterval 60 (keep the session alive), ProxyJump bastion (through a bastion).

Loading…