Create a public/private key
$ ssh-keygen -t dsa|rsa
SSH logins are slow because ssh clients are attempting to to use GSSAPIAuthentication when the server doesn't support it
# vi /etc/ssh/ssh_config
-GSSAPIAuthentication yes
+#GSSAPIAuthentication yes
Temporarily ignore known SSH hosts
$ ssh -o UserKnownHostsFile=/dev/null root@192.168.1.1
Tunneling ssh X over multiple ssh hosts (through ssh proxy)
$ ssh -t -X -A user@sshproxy ssh -X -A user@sshhost
Change user within ssh session retaining the current MIT cookie for X-forwading
$ su username -c "xauth add ${HOSTNAME}/unix:${DISPLAY//[a-zA-Z:_-]/} $(xauth list | grep -o '[a-zA-Z0-9_-]*\ *[0-9a-zA-Z]*$'); bash"
Copy your ssh public key to a server from a machine that doesn't have ssh-copy-id
$ cat ~/.ssh/id_rsa.pub | ssh user@machine "mkdir ~/.ssh; cat >> ~/.ssh/authorized_keys" $ ssh -N -L 2001:localhost:80 somemachine
Notice the additional -f flag - it makes ssh daemonize (go into background) so it didn’t consume a terminal. Unfreeze a hung shell press [enter] then ~. Escape characters list ~. Disconnect. ~^Z Background ssh. ~# List forwarded connections. ~& Background ssh at logout when waiting for forwarded connection / X11 sessions to terminate. ~? Display a list of escape characters. ~B Send a BREAK to the remote system (only useful for SSH protocol version 2 and if the peer supports it). ~C Open command line. Currently this allows the addition of port forwardings using the -L, -R and -D options (see above). It also allows the cancellation of existing remote port-forwardings using -KR[bind_address:]port. !command allows the user to execute a local command if the PermitLocalCommand option is enabled in ssh_config(5). Basic help is available, using the -h option. ~R Request rekeying of the connection (only useful for SSH protocol version 2 and if the peer supports it). |
Notes >