2016-09-22 08:03:38 +01:00
# ssh
2014-02-01 16:48:38 +11:00
> 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.
2021-10-03 11:39:34 -03:00
> More information: <https://man.openbsd.org/ssh>.
2014-01-31 23:31:35 +08:00
2016-01-15 14:41:03 +00:00
- Connect to a remote server:
2014-02-01 16:48:38 +11:00
`ssh {{username}}@{{remote_host}}`
2014-01-31 23:31:35 +08:00
2016-01-15 14:41:03 +00:00
- Connect to a remote server with a specific identity (private key):
2014-02-28 23:12:10 +11:00
2016-10-18 10:27:47 +05:30
`ssh -i {{path/to/key_file}} {{username}}@{{remote_host}}`
2014-02-28 23:12:10 +11:00
2024-03-14 02:01:06 -03:00
- Connect to a remote server using a specific [p]ort:
2014-02-01 16:48:38 +11:00
2014-03-01 11:46:48 +05:30
`ssh {{username}}@{{remote_host}} -p {{2222}}`
2014-01-31 23:31:35 +08:00
2021-10-03 11:39:34 -03:00
- Run a command on a remote server with a [t]ty allocation allowing interaction with the remote command:
2015-10-22 15:31:52 +08:00
2021-10-03 11:39:34 -03:00
`ssh {{username}}@{{remote_host}} -t {{command}} {{command_arguments}}`
2014-02-18 12:31:59 +11:00
2024-03-14 02:01:06 -03:00
- SSH tunneling: [D]ynamic port forwarding (SOCKS proxy on `localhost:1080` ):
2014-02-01 16:48:38 +11:00
2021-04-15 18:47:49 -07:00
`ssh -D {{1080}} {{username}}@{{remote_host}}`
A bunch of new pages:
common/: dig, gzip, rm, sort, zfs, zpool
linux/: apt-get, shutdown
osx/: airport, caffeinate, diskutil, networksetup open, pgrep, qlmanage, say, shutdown, sysctl, system_profiler
Edits to existing pages:
curl: Added simple download example
find: Added iname and size exmaples
grep: Edited -c description
ps: Added wide lines example
ssh: edited -D description, added simple port forwarding example
unzip: added list option
2014-02-10 12:36:05 -08:00
2021-10-03 11:39:34 -03:00
- 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:
A bunch of new pages:
common/: dig, gzip, rm, sort, zfs, zpool
linux/: apt-get, shutdown
osx/: airport, caffeinate, diskutil, networksetup open, pgrep, qlmanage, say, shutdown, sysctl, system_profiler
Edits to existing pages:
curl: Added simple download example
find: Added iname and size exmaples
grep: Edited -c description
ps: Added wide lines example
ssh: edited -D description, added simple port forwarding example
unzip: added list option
2014-02-10 12:36:05 -08:00
2019-05-09 18:07:48 +02:00
`ssh -L {{9999}}:{{example.org}}:{{80}} -N -T {{username}}@{{remote_host}}`
2014-08-26 23:33:18 +01:00
2024-03-14 02:01:06 -03:00
- SSH [J]umping: 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 07:21:47 +02:00
`ssh -J {{username}}@{{jump_host}} {{username}}@{{remote_host}}`
2024-10-11 20:24:31 +03:00
- Close a hanged session:
2018-06-21 07:21:47 +02:00
2025-03-09 03:23:24 +02:00
`<Enter><~><.>`