2013-08-27 02:34:36 +02:00
|
|
|
# To ssh via pem file (which normally needs 0600 permissions):
|
|
|
|
ssh -i /path/to/file.pem user@example.com
|
|
|
|
|
2013-08-28 14:15:50 +02:00
|
|
|
# To connect on an non-standard port:
|
|
|
|
ssh -p 2222 user@example.com
|
|
|
|
|
2014-12-26 21:57:01 +01:00
|
|
|
# To connect and forward the authentication agent
|
|
|
|
ssh -A user@example.com
|
|
|
|
|
2013-08-22 03:34:11 +02:00
|
|
|
# To execute a command on a remote server:
|
2013-08-11 21:37:11 +02:00
|
|
|
ssh -t user@example.com 'the-remote-command'
|
|
|
|
|
2013-08-22 03:34:11 +02:00
|
|
|
# To tunnel an x session over SSH:
|
2013-08-11 21:37:11 +02:00
|
|
|
ssh -X user@example.com
|
|
|
|
|
2015-01-06 02:44:25 +01:00
|
|
|
# Redirect traffic with a tunnel between local host (port 8080) and a remote
|
|
|
|
# host (remote.example.com:5000) through a proxy (personal.server.com):
|
2014-11-22 18:15:51 +01:00
|
|
|
ssh -f -L 8080:remote.example.com:5000 user@personal.server.com -N
|
|
|
|
|
2013-08-22 03:34:11 +02:00
|
|
|
# To launch a specific x application over SSH:
|
2013-08-11 21:37:11 +02:00
|
|
|
ssh -X -t user@example.com 'chromium-browser'
|
|
|
|
|
2013-12-03 21:20:11 +01:00
|
|
|
# To create a SOCKS proxy on localhost and port 9999
|
|
|
|
ssh -D 9999 user@example.com
|
|
|
|
|
2014-03-27 15:44:06 +01:00
|
|
|
# -X use an xsession, -C compress data, "-c blowfish" use the encryption blowfish
|
|
|
|
ssh user@example.com -C -c blowfish -X
|
|
|
|
|
2013-08-22 03:34:11 +02:00
|
|
|
# For more information, see:
|
|
|
|
# http://unix.stackexchange.com/q/12755/44856
|
2015-08-06 14:46:21 +02:00
|
|
|
|
|
|
|
# Copy files and folders through ssh from remote host to pwd with tar.gz compression
|
|
|
|
# when there is no rsync command available
|
|
|
|
ssh user@example.com "cd /var/www/Shared/; tar zcf - asset1 asset2" | tar zxf -
|
2016-04-05 17:09:49 +02:00
|
|
|
|
|
|
|
# Mount folder/filesystem through SSH
|
2016-04-19 13:45:47 +02:00
|
|
|
# Install SSHFS from https://github.com/libfuse/sshfs
|
|
|
|
# Will allow you to mount a folder securely over a network.
|
2016-04-05 17:09:49 +02:00
|
|
|
sshfs name@server:/path/to/folder /path/to/mount/point
|
2016-04-19 13:45:47 +02:00
|
|
|
|
|
|
|
# Emacs can read file through SSH
|
|
|
|
# Doc: http://www.gnu.org/software/emacs/manual/html_node/emacs/Remote-Files.html
|
|
|
|
emacs /ssh:name@server:/path/to/file
|