2016-09-22 10:03:38 +03:00
|
|
|
# ssh
|
2014-02-01 09:48:38 +04: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.
|
2014-01-31 19:31:35 +04:00
|
|
|
|
2016-01-15 17:41:03 +03:00
|
|
|
- Connect to a remote server:
|
2014-02-01 09:48:38 +04:00
|
|
|
|
|
|
|
`ssh {{username}}@{{remote_host}}`
|
2014-01-31 19:31:35 +04:00
|
|
|
|
2016-01-15 17:41:03 +03:00
|
|
|
- Connect to a remote server with a specific identity (private key):
|
2014-02-28 16:12:10 +04:00
|
|
|
|
2016-10-18 07:57:47 +03:00
|
|
|
`ssh -i {{path/to/key_file}} {{username}}@{{remote_host}}`
|
2014-02-28 16:12:10 +04:00
|
|
|
|
2016-01-15 17:41:03 +03:00
|
|
|
- Connect to a remote server using a specific port:
|
2014-02-01 09:48:38 +04:00
|
|
|
|
2014-03-01 10:16:48 +04:00
|
|
|
`ssh {{username}}@{{remote_host}} -p {{2222}}`
|
2014-01-31 19:31:35 +04:00
|
|
|
|
2016-01-07 20:31:27 +03:00
|
|
|
- Run a command on a remote server:
|
2015-10-22 10:31:52 +03:00
|
|
|
|
2016-01-05 21:37:25 +03:00
|
|
|
`ssh {{remote_host}} {{command -with -flags}}`
|
2014-02-18 05:31:59 +04:00
|
|
|
|
2016-01-15 17:41:03 +03:00
|
|
|
- SSH tunneling: Dynamic port forwarding (SOCKS proxy on localhost:9999):
|
2014-02-01 09:48:38 +04:00
|
|
|
|
|
|
|
`ssh -D {{9999}} -C {{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-11 00:36:05 +04:00
|
|
|
|
2016-01-15 17:41:03 +03:00
|
|
|
- SSH tunneling: Forward a specific port (localhost:9999 to slashdot.org:80):
|
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-11 00:36:05 +04:00
|
|
|
|
|
|
|
`ssh -L {{9999}}:slashdot.org:80 {{username}}@{{remote_host}}`
|
2014-08-27 02:33:18 +04:00
|
|
|
|
2016-10-18 10:31:23 +03:00
|
|
|
- Enable the option to forward the authentication information to the remote machine (see `man ssh_config` for available options):
|
2014-08-27 02:36:49 +04:00
|
|
|
|
2016-10-18 07:57:47 +03:00
|
|
|
`ssh -o "ForwardAgent=yes" {{username}}@{{remote_host}}`
|