forked from qinshulei/ubuntu-cheat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ssh
36 lines (25 loc) · 1023 Bytes
/
ssh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# To ssh via pem file (which normally needs 0600 permissions):
ssh -i /path/to/file.pem [email protected]
# To connect on an non-standard port:
ssh -p 2222 [email protected]
# To execute a command on a remote server:
ssh -t [email protected] 'the-remote-command'
# To tunnel an x session over SSH:
ssh -X [email protected]
# To launch a specific x application over SSH:
ssh -X -t [email protected] 'chromium-browser'
# To create a SOCKS proxy on localhost and port 9999
ssh -D 9999 [email protected]
# -X use an xsession, -C compress data, "-c blowfish" use the encryption blowfish
ssh [email protected] -C -c blowfish -X
# SSH: Port Forwarding
ssh -qTfnN -L port:host:hostport -l user remote_ip
ssh -qTfnN -R port:host:hostport -l user remote_ip
# ssh proxy
ssh -qTfnN -D 7070 username@sshserver
# ssh local forward
ssh -CfNg -L 6300:127.0.0.1:1521 [email protected]
# ssh remote forward
ssh -CfNg -R 1521:127.0.0.1:6300 [email protected]
# For more information, see:
# http://unix.stackexchange.com/q/12755/44856