ssh.rst
author Oleksandr Gavenko <gavenkoa@gmail.com>
Sat, 10 Feb 2018 01:28:53 +0200
changeset 2227 1e9323e7ec88
parent 1957 cd6f239a8dd3
child 2228 837f1337c59b
permissions -rw-r--r--
Removed files: I don't longer have interest on topic.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1334
9bf0d5a1f0cf Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1032
diff changeset
     1
.. -*- coding: utf-8; -*-
1002
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     2
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     3
===========
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     4
 SSH/sshd.
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     5
===========
1032
4decc3e00bb6 Fix coding and contents.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1002
diff changeset
     6
.. contents::
1904
78357d58b7ab Fix RST syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1858
diff changeset
     7
   :local:
1002
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     8
1385
acb36dfe5d09 Debugging ssh client.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1384
diff changeset
     9
Debugging ssh client.
acb36dfe5d09 Debugging ssh client.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1384
diff changeset
    10
=====================
acb36dfe5d09 Debugging ssh client.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1384
diff changeset
    11
::
acb36dfe5d09 Debugging ssh client.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1384
diff changeset
    12
acb36dfe5d09 Debugging ssh client.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1384
diff changeset
    13
  $ ssh -vvv ...
acb36dfe5d09 Debugging ssh client.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1384
diff changeset
    14
1002
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    15
Maintaining key pair.
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    16
=====================
1957
cd6f239a8dd3 Check available key types.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1956
diff changeset
    17
cd6f239a8dd3 Check available key types.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1956
diff changeset
    18
Check available key types::
cd6f239a8dd3 Check available key types.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1956
diff changeset
    19
cd6f239a8dd3 Check available key types.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1956
diff changeset
    20
  $ ssh -Q key
cd6f239a8dd3 Check available key types.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1956
diff changeset
    21
cd6f239a8dd3 Check available key types.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1956
diff changeset
    22
Generate keys::
1002
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    23
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    24
  $ ssh-keygen -t dsa     # for DSA
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    25
  $ ssh-keygen -t rsa     # for RSA
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    26
  $ ssh-keygen -t dsa -C comment     # put own comment instead user@host
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    27
  $ ssh-keygen -t dsa -f my_dsa_key  # store priv key under my_dsa_key
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    28
                                     # and pub key under my_dsa_key.pub
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    29
1626
73fa021859e7 recover pub key from priv
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1595
diff changeset
    30
  $ ssh-keygen -y -f ~/.ssh/id_dsa >~/.ssh/id_dsa.pub  # recover pub key from priv
1002
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    31
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    32
  $ ssh-keygen -p -N "newphrase" -P "oldphrase" -f ~/.ssh/id_dsa
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    33
                                     # change passphrase of priv key
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    34
1858
c6dc48292ee8 Coping and deleting public keys.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1680
diff changeset
    35
Coping and deleting public keys.
c6dc48292ee8 Coping and deleting public keys.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1680
diff changeset
    36
================================
c6dc48292ee8 Coping and deleting public keys.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1680
diff changeset
    37
c6dc48292ee8 Coping and deleting public keys.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1680
diff changeset
    38
To copy your public key to remote host (for automatic login by pubkey
c6dc48292ee8 Coping and deleting public keys.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1680
diff changeset
    39
authentication)::
c6dc48292ee8 Coping and deleting public keys.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1680
diff changeset
    40
1002
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    41
  $ ssh $user@$host cat ">>" "~/.ssh/authorized_keys" <~/.ssh/id_rsa.pub
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    42
                                     # public pub key on remote host
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    43
1595
7f512266d262 ssh-copy-id
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1386
diff changeset
    44
  $ ssh-copy-id  $user@$host         # alternative to previous command
7f512266d262 ssh-copy-id
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1386
diff changeset
    45
1858
c6dc48292ee8 Coping and deleting public keys.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1680
diff changeset
    46
To remove ``known_hosts`` key (usually need if you change server pubkey or
c6dc48292ee8 Coping and deleting public keys.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1680
diff changeset
    47
change server)::
c6dc48292ee8 Coping and deleting public keys.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1680
diff changeset
    48
c6dc48292ee8 Coping and deleting public keys.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1680
diff changeset
    49
  $ ssh-keygen -R hostname
c6dc48292ee8 Coping and deleting public keys.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1680
diff changeset
    50
  $ ssh-keygen -R hostname -f ~/.ssh/known_hosts
c6dc48292ee8 Coping and deleting public keys.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1680
diff changeset
    51
1002
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    52
Shell login.
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    53
============
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    54
::
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    55
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    56
  $ ssh $user@$host
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    57
  $ ssh $user@$host:$port
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    58
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    59
  $ ssh -i ~/.ssh/my_dsa_key $user@$host
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    60
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    61
or::
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    62
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    63
  $ ssh -l $user $host
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    64
  $ ssh -l $user $host:$port
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    65
1384
9698523dd263 X11 forwarding.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1383
diff changeset
    66
X11 forwarding.
9698523dd263 X11 forwarding.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1383
diff changeset
    67
===============
9698523dd263 X11 forwarding.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1383
diff changeset
    68
9698523dd263 X11 forwarding.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1383
diff changeset
    69
Enable X11 forwarding on remote host in ``~/.ssh/config`` or ``/etc/ssh_config``::
9698523dd263 X11 forwarding.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1383
diff changeset
    70
9698523dd263 X11 forwarding.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1383
diff changeset
    71
  X11Forwarding yes
9698523dd263 X11 forwarding.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1383
diff changeset
    72
9698523dd263 X11 forwarding.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1383
diff changeset
    73
then login to this host by::
1002
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    74
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    75
  $ ssh -X $user@$host
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    76
1384
9698523dd263 X11 forwarding.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1383
diff changeset
    77
or by using trusted X11 forwarding::
9698523dd263 X11 forwarding.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1383
diff changeset
    78
9698523dd263 X11 forwarding.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1383
diff changeset
    79
  $ ssh -Y $user@$host
9698523dd263 X11 forwarding.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1383
diff changeset
    80
1386
864237ce5f1b X11Forwarding does not work with OpenSSH under Cygwin
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1385
diff changeset
    81
See:
864237ce5f1b X11Forwarding does not work with OpenSSH under Cygwin
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1385
diff changeset
    82
864237ce5f1b X11Forwarding does not work with OpenSSH under Cygwin
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1385
diff changeset
    83
  http://x.cygwin.com/docs/faq/cygwin-x-faq.html#q-ssh-no-x11forwarding
1904
78357d58b7ab Fix RST syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1858
diff changeset
    84
    X11Forwarding does not work with OpenSSH under Cygwin
1384
9698523dd263 X11 forwarding.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1383
diff changeset
    85
1002
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    86
Multiply private keys.
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    87
======================
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    88
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    89
ssh try use all listen keys::
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    90
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    91
  $ ssh -i ./priv1 -i ./priv2 $user@$host
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    92
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    93
or place in ~/.ssh/config::
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    94
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    95
  Host *
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    96
  IdentityFile ~/.ssh/identity # standard search path for protocol ver. 1
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    97
  IdentityFile ~/.ssh/id_dsa   # standard search path for RSA key protocol ver. 2
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    98
  IdentityFile ~/.ssh/id_rsa   # standard search path for DSA key protocol ver. 2
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    99
  IdentityFile ~/.ssh/my_dsa
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   100
  IdentityFile ~/.ssh/another_dsa
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   101
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   102
or per host private key::
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   103
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   104
  Host host1                   # alias, that user provide at CLI
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   105
  HostName host1.example.com   # real host name to log into
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   106
  User iam
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   107
  IdentifyFile ~/.ssh/iam_priv_dsa
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   108
  Host host2                   # alias, that user provide at CLI
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   109
  HostName 192.168.1.2         # real host IP to log into
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   110
  User admin
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   111
  IdentifyFile ~/.ssh/admin_priv_dsa
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   112
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   113
Installing sshd on Cygwin.
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   114
==========================
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   115
1904
78357d58b7ab Fix RST syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1858
diff changeset
   116
* Install base packages and openssh.
1954
307ce848ea6a Update instruction for sshd under Cygwin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
   117
* Create Windows user and set its password.
1904
78357d58b7ab Fix RST syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1858
diff changeset
   118
* Recreate /etc/passwd::
78357d58b7ab Fix RST syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1858
diff changeset
   119
78357d58b7ab Fix RST syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1858
diff changeset
   120
    $ mkpasswd -l -u user >>/etc/passwd
78357d58b7ab Fix RST syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1858
diff changeset
   121
78357d58b7ab Fix RST syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1858
diff changeset
   122
  or::
78357d58b7ab Fix RST syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1858
diff changeset
   123
78357d58b7ab Fix RST syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1858
diff changeset
   124
    $ mkpasswd -l >/etc/passwd
78357d58b7ab Fix RST syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1858
diff changeset
   125
78357d58b7ab Fix RST syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1858
diff changeset
   126
* Register sshd::
1002
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   127
1904
78357d58b7ab Fix RST syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1858
diff changeset
   128
    $ mkdir -p /home/user
78357d58b7ab Fix RST syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1858
diff changeset
   129
    $ ssh-host-config -y
78357d58b7ab Fix RST syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1858
diff changeset
   130
78357d58b7ab Fix RST syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1858
diff changeset
   131
* Start::
78357d58b7ab Fix RST syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1858
diff changeset
   132
78357d58b7ab Fix RST syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1858
diff changeset
   133
    $ net start sshd
1002
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   134
1904
78357d58b7ab Fix RST syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1858
diff changeset
   135
  or::
78357d58b7ab Fix RST syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1858
diff changeset
   136
78357d58b7ab Fix RST syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1858
diff changeset
   137
    $ cygrunsrv -S sshd
78357d58b7ab Fix RST syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1858
diff changeset
   138
78357d58b7ab Fix RST syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1858
diff changeset
   139
* Check from remote host::
78357d58b7ab Fix RST syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1858
diff changeset
   140
78357d58b7ab Fix RST syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1858
diff changeset
   141
    $ ssh $gygwin_host -l user
1002
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   142
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   143
To stop service use::
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   144
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   145
  $ net stop sshd
1680
826133768ee5 connection closed fix.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1626
diff changeset
   146
  $ cygrunsrv -E sshd
1002
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   147
1954
307ce848ea6a Update instruction for sshd under Cygwin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
   148
To delete service::
307ce848ea6a Update instruction for sshd under Cygwin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
   149
307ce848ea6a Update instruction for sshd under Cygwin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
   150
  $ cygrunsrv -E sshd
307ce848ea6a Update instruction for sshd under Cygwin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
   151
  $ cygrunsrv -R sshd
307ce848ea6a Update instruction for sshd under Cygwin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
   152
1680
826133768ee5 connection closed fix.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1626
diff changeset
   153
If you have ``connection closed`` error check permission for ``/home/*/.ssh``
826133768ee5 connection closed fix.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1626
diff changeset
   154
directories. If you start service from ``user`` account - add write permission
826133768ee5 connection closed fix.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1626
diff changeset
   155
to ``/home/*/.ssh``. I fix by::
1002
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   156
1680
826133768ee5 connection closed fix.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1626
diff changeset
   157
  $ rm -r /home/*/.ssh
826133768ee5 connection closed fix.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1626
diff changeset
   158
  cmd> icacls c:\opt\cygwin\home /t /grant:r cyg_server:(f)
1002
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   159
1954
307ce848ea6a Update instruction for sshd under Cygwin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
   160
In order to enable logging from ``sshd`` uncomment in ``/etc/ssh/sshd_config``::
1002
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   161
1954
307ce848ea6a Update instruction for sshd under Cygwin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
   162
  SyslogFacility AUTH
307ce848ea6a Update instruction for sshd under Cygwin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
   163
  LogLevel INFO
1002
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   164
1954
307ce848ea6a Update instruction for sshd under Cygwin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
   165
and start syslogd from ``inetutils`` package (don't forget to restart
307ce848ea6a Update instruction for sshd under Cygwin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
   166
``sshd``!)::
1002
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   167
1954
307ce848ea6a Update instruction for sshd under Cygwin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
   168
  $ /bin/syslogd-config
307ce848ea6a Update instruction for sshd under Cygwin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
   169
  $ net start syslogd
1002
234cd58cae56 Fix RTS syntax.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
   170
1954
307ce848ea6a Update instruction for sshd under Cygwin.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
   171
Check ``/var/log/messages`` for logging messages.
1955
62735335fcef userauth_pubkey: key type ssh-dss not in PubkeyAcceptedKeyTypes
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1954
diff changeset
   172
62735335fcef userauth_pubkey: key type ssh-dss not in PubkeyAcceptedKeyTypes
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1954
diff changeset
   173
.. note::
62735335fcef userauth_pubkey: key type ssh-dss not in PubkeyAcceptedKeyTypes
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1954
diff changeset
   174
62735335fcef userauth_pubkey: key type ssh-dss not in PubkeyAcceptedKeyTypes
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1954
diff changeset
   175
   In order to allow pubkey login and to avoid error::
62735335fcef userauth_pubkey: key type ssh-dss not in PubkeyAcceptedKeyTypes
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1954
diff changeset
   176
62735335fcef userauth_pubkey: key type ssh-dss not in PubkeyAcceptedKeyTypes
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1954
diff changeset
   177
     userauth_pubkey: key type ssh-dss not in PubkeyAcceptedKeyTypes
62735335fcef userauth_pubkey: key type ssh-dss not in PubkeyAcceptedKeyTypes
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1954
diff changeset
   178
1956
5f39abb7d5b0 DSS keys are depricated at all
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1955
diff changeset
   179
   add ``PubkeyAcceptedKeyTypes *`` or ``PubkeyAcceptedKeyTypes=+ssh-dss`` to
5f39abb7d5b0 DSS keys are depricated at all
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1955
diff changeset
   180
   ``/etc/ssh/sshd_config`` but DSS keys are depricated at all.
1955
62735335fcef userauth_pubkey: key type ssh-dss not in PubkeyAcceptedKeyTypes
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1954
diff changeset
   181