ssh

goj edited this page Oct 28, 2011 · 7 revisions
Clone this wiki locally

Some random ssh mumbo-jumbo

Copying Identity

Instead of scp-ing id_rsa.pub, ssh-ing to remote machine (and typing the password again) you can use ssh-copy-id script:

ssh-copy-id -i .ssh/id_rsa.pub $REMOTE_MACHINE

More info here.

Logging in via the middle-man

Situation: from machine A you log in to B (middle-man) just in order to log into C. Add something like

Host destination
ProxyCommand ssh middle-man nc %h %p

to your local .ssh/config file. %h can be substituted with destination's IP if there is some DNS/hostname screwup. More info here.

Opening the tunnel

Use ssh -fN $MIDDLEMAN -L $LOCAL_PORT:$DESTINATION:$DESTINATION_PORT.

In simple case $MIDDLEMAN == $DESTINATION. Options used:

  • -f - go to background
  • -N - don't execute any commands
  • -L XXX - forward ports

Read this for more details.

channel _: open failed: administratively prohibited: open failed

It may be tunneling turned off or DNS screwup. Try some combination of the following in /etc/ssh/sshd_config:

PermitTunnel yes
UseDNS no

Don't forget to restart the server afterwards.

Logging in takes ages

It may be DNS reverse lookup

UseDNS no