ssh.rst
changeset 2397 320b2c43529b
parent 2228 837f1337c59b
child 2408 c19423f2e7ee
equal deleted inserted replaced
2396:f6aa28b6c706 2397:320b2c43529b
    10 =====================
    10 =====================
    11 ::
    11 ::
    12 
    12 
    13   $ ssh -vvv ...
    13   $ ssh -vvv ...
    14 
    14 
    15 Maintaining key pair.
    15 Maintaining key pair
    16 =====================
    16 ====================
    17 
    17 
    18 Check available key types::
    18 Check available key types::
    19 
    19 
    20   $ ssh -Q key
    20   $ ssh -Q key
    21 
    21 
    30   $ ssh-keygen -y -f ~/.ssh/id_dsa >~/.ssh/id_dsa.pub  # recover pub key from priv
    30   $ ssh-keygen -y -f ~/.ssh/id_dsa >~/.ssh/id_dsa.pub  # recover pub key from priv
    31 
    31 
    32   $ ssh-keygen -p -N "newphrase" -P "oldphrase" -f ~/.ssh/id_dsa
    32   $ ssh-keygen -p -N "newphrase" -P "oldphrase" -f ~/.ssh/id_dsa
    33                                      # change passphrase of priv key
    33                                      # change passphrase of priv key
    34 
    34 
    35 Coping and deleting public keys.
    35 Coping and deleting public keys
    36 ================================
    36 ===============================
    37 
    37 
    38 To copy your public key to remote host (for automatic login by pubkey
    38 To copy your public key to remote host (for automatic login by pubkey
    39 authentication)::
    39 authentication)::
    40 
    40 
    41   $ ssh $user@$host cat ">>" "~/.ssh/authorized_keys" <~/.ssh/id_rsa.pub
    41   $ ssh $user@$host cat ">>" "~/.ssh/authorized_keys" <~/.ssh/id_rsa.pub
    47 change server)::
    47 change server)::
    48 
    48 
    49   $ ssh-keygen -R hostname
    49   $ ssh-keygen -R hostname
    50   $ ssh-keygen -R hostname -f ~/.ssh/known_hosts
    50   $ ssh-keygen -R hostname -f ~/.ssh/known_hosts
    51 
    51 
       
    52 Disabling pubkey
       
    53 ================
       
    54 ::
       
    55 
       
    56   ssh -o PreferredAuthentications=password -o PubkeyAuthentication=no user@host
       
    57 
    52 Shell login.
    58 Shell login.
    53 ============
    59 ============
    54 ::
    60 ::
    55 
    61 
    56   $ ssh $user@$host
    62   $ ssh $user@$host
    61 or::
    67 or::
    62 
    68 
    63   $ ssh -l $user $host
    69   $ ssh -l $user $host
    64   $ ssh -l $user $host:$port
    70   $ ssh -l $user $host:$port
    65 
    71 
    66 X11 forwarding.
    72 X11 forwarding
    67 ===============
    73 ==============
    68 
    74 
    69 Enable X11 forwarding on remote host in ``~/.ssh/config`` or ``/etc/ssh_config``::
    75 Enable X11 forwarding on remote host in ``~/.ssh/config`` or ``/etc/ssh_config``::
    70 
    76 
    71   X11Forwarding yes
    77   X11Forwarding yes
    72 
    78 
    81 See:
    87 See:
    82 
    88 
    83 http://x.cygwin.com/docs/faq/cygwin-x-faq.html#q-ssh-no-x11forwarding
    89 http://x.cygwin.com/docs/faq/cygwin-x-faq.html#q-ssh-no-x11forwarding
    84   X11Forwarding does not work with OpenSSH under Cygwin
    90   X11Forwarding does not work with OpenSSH under Cygwin
    85 
    91 
    86 Multiply private keys.
    92 Multiply private keys
    87 ======================
    93 =====================
    88 
    94 
    89 ssh try use all listen keys::
    95 ``ssh`` tries to use all provided keys::
    90 
    96 
    91   $ ssh -i ./priv1 -i ./priv2 $user@$host
    97   $ ssh -i ./priv1 -i ./priv2 $user@$host
    92 
    98 
    93 or place in ~/.ssh/config::
    99 Alternatively place them to ``~/.ssh/config``::
    94 
   100 
    95   Host *
   101   Host *
    96   IdentityFile ~/.ssh/identity # standard search path for protocol ver. 1
   102   IdentityFile ~/.ssh/identity # standard search path for protocol ver. 1
    97   IdentityFile ~/.ssh/id_dsa   # standard search path for RSA key protocol ver. 2
   103   IdentityFile ~/.ssh/id_dsa   # standard search path for RSA key protocol ver. 2
    98   IdentityFile ~/.ssh/id_rsa   # standard search path for DSA key protocol ver. 2
   104   IdentityFile ~/.ssh/id_rsa   # standard search path for DSA key protocol ver. 2
   108   Host host2                   # alias, that user provide at CLI
   114   Host host2                   # alias, that user provide at CLI
   109   HostName 192.168.1.2         # real host IP to log into
   115   HostName 192.168.1.2         # real host IP to log into
   110   User admin
   116   User admin
   111   IdentifyFile ~/.ssh/admin_priv_dsa
   117   IdentifyFile ~/.ssh/admin_priv_dsa
   112 
   118 
   113 Installing sshd on Cygwin.
   119 Installing sshd on Cygwin
   114 ==========================
   120 =========================
   115 
   121 
   116 * Install base packages and openssh.
   122 * Install base packages and openssh.
   117 * Create Windows user and set its password.
   123 * Create Windows user and set its password.
   118 * Recreate /etc/passwd::
   124 * Recreate /etc/passwd::
   119 
   125