tldr/pages/common/ssh.md

38 lines
1.4 KiB
Markdown
Raw Normal View History

# ssh
> Secure Shell is a protocol used to securely log onto remote systems.
> It can be used for logging or executing commands on a remote server.
> More information: <https://man.openbsd.org/ssh>.
2014-01-31 15:31:35 +00:00
2016-01-15 14:41:03 +00:00
- Connect to a remote server:
`ssh {{username}}@{{remote_host}}`
2014-01-31 15:31:35 +00:00
2016-01-15 14:41:03 +00:00
- Connect to a remote server with a specific identity (private key):
`ssh -i {{path/to/key_file}} {{username}}@{{remote_host}}`
2016-01-15 14:41:03 +00:00
- Connect to a remote server using a specific port:
`ssh {{username}}@{{remote_host}} -p {{2222}}`
2014-01-31 15:31:35 +00:00
- Run a command on a remote server with a [t]ty allocation allowing interaction with the remote command:
2015-10-22 08:31:52 +01:00
`ssh {{username}}@{{remote_host}} -t {{command}} {{command_arguments}}`
2022-01-16 16:28:18 +00:00
- SSH tunneling: Dynamic port forwarding (SOCKS proxy on `localhost:1080`):
`ssh -D {{1080}} {{username}}@{{remote_host}}`
- SSH tunneling: Forward a specific port (`localhost:9999` to `example.org:80`) along with disabling pseudo-[T]ty allocation and executio[N] of remote commands:
`ssh -L {{9999}}:{{example.org}}:{{80}} -N -T {{username}}@{{remote_host}}`
2018-06-21 06:21:47 +01:00
- SSH jumping: Connect through a jumphost to a remote server (Multiple jump hops may be specified separated by comma characters):
2014-08-26 23:36:49 +01:00
2018-06-21 06:21:47 +01:00
`ssh -J {{username}}@{{jump_host}} {{username}}@{{remote_host}}`
- Agent forwarding: Forward the authentication information to the remote machine (see `man ssh_config` for available options):
`ssh -A {{username}}@{{remote_host}}`