ssh¶
OpenSSH SSH client (remote login program)
SSH in via PEM file, which normally needs 0600 permissions
ssh -i /path/to/file.pem [email protected]
Connect through a non-standard port. It's recommended not to use the default
port of 22, as it is so often targeted, due to it being so commonplace.
ssh -p 2222 [email protected]
Connect and forward the authentication agent
ssh -A [email protected]
Execute a command on a remote server
ssh -t [email protected] 'the-remote-command'
Tunnel an X session over SSH, via X11 Forwarding
ssh -X [email protected]
Redirect traffic with a tunnel between local host (port 8080) and a remote
host (remote.example.com:5000) through a proxy (personal.server.com).
ssh -f -L 8080:remote.example.com:5000 [email protected] -N
Launch a specific X application over SSH
ssh -X -t [email protected] 'chromium-browser'
Create a SOCKS proxy on localhost and port 9999
ssh -D 9999 [email protected]
Connect to server, but allow for X11 forwarding, while also using Gzip
compression (can be much faster; YMMV), and using the blowfish encryption.
For more information, see: http://unix.stackexchange.com/q/12755/44856
ssh -XCc blowfish [email protected]
Copy files and directories, via SSH, from remote host to the current working
directory, with Gzip compression. An option for when rsync isn't available.
This works by creating (not temporary!) a remote Tar archive, then piping its output to a local Tar process, which then extracts it to STDOUT.
ssh [email protected] 'tar -C /var/www/Shared/ zcf - asset1 asset2' | tar zxf -
Explicitly specify a key for connection. Useful if you have too many
authentication failures for a given username.
Temporarily disable pubkey authentication for this instance
ssh -o PubkeyAuthentication=no [email protected]
Mount a remote directory or filesystem, through SSH, to a local mount point
Install SSHFS from: https://github.com/libfuse/sshfs
EMACS can read files through SSH. Below, is a link to related documentation
http://www.gnu.org/software/emacs/manual/html_node/emacs/Remote-Files.html
Get help for SSH escape sequences. Useful for terminating unresponsive
sessions. The default escape character is ~ (tilde), escapes are only recognized immediately after a newline.
To connect to a host with a specific key exchange algorithm
Full list of available algorithms : man ssh_config
Redirect traffic with a tunnel between local host (port 8080) and a remote
host (remote.example.com:5000) through a proxy (personal.server.com):
ssh -f -L 8080:remote.example.com:5000 [email protected] -N
To tunnel an ssh session over the SOCKS proxy on localhost and port 9999
-X use an xsession, -C compress data, "-c blowfish" use the encryption blowfish
For more information, see
http://unix.stackexchange.com/q/12755/44856 To copy files and folders through ssh from remote host to pwd with tar.gz compression when there is no rsync command available:
To mount folder/filesystem through SSH
Install SSHFS from https://github.com/libfuse/sshfs Will allow you to mount a folder securely over a network.
Emacs can read file through SSH
Doc: http://www.gnu.org/software/emacs/manual/html_node/emacs/Remote-Files.html
Permissions https://superuser.com/q/215504/352242