Cygwin OpenSSH fecha imediatamente após uma conexão

4

Tentando se conectar ao cygwin-sshd usando o putty ou o cygwin ssh no localhost, aqui está tudo o que recebo. Eu tenho que funcionar bem em uma máquina Win7x64 diferente, mas esta está provando infernal. Arquivos de configuração para ambas as máquinas são idênticos.

Putty me diz isso:

2013-03-08 14:36:16 Connecting to 127.0.0.1 port 22
2013-03-08 14:36:16 Server version: SSH-2.0-OpenSSH_6.1
2013-03-08 14:36:16 Using SSH protocol version 2
2013-03-08 14:36:16 We claim version: SSH-2.0-PuTTY_Release_0.62
2013-03-08 14:36:16 Doing Diffie-Hellman group exchange
2013-03-08 14:36:16 Doing Diffie-Hellman key exchange with hash SHA-256
2013-03-08 14:36:16 Host key fingerprint is:
2013-03-08 14:36:16 ssh-rsa 2048 48:e0:21:ce:d7:bc:85:b4:f7:3e:49:08:31:4d:55:5a
2013-03-08 14:36:16 Initialised AES-256 SDCTR client->server encryption
2013-03-08 14:36:16 Initialised HMAC-SHA1 client->server MAC algorithm
2013-03-08 14:36:16 Initialised AES-256 SDCTR server->client encryption
2013-03-08 14:36:16 Initialised HMAC-SHA1 server->client MAC algorithm
2013-03-08 14:36:18 Attempting keyboard-interactive authentication
2013-03-08 14:36:18 Server refused keyboard-interactive authentication
2013-03-08 14:36:21 Sent password
2013-03-08 14:36:21 Access granted
2013-03-08 14:36:21 Opened channel for session
2013-03-08 14:36:21 Allocated pty (ospeed 38400bps, ispeed 38400bps)
2013-03-08 14:36:21 Started a shell/command
2013-03-08 14:36:21 Server sent command exit status 0
2013-03-08 14:36:43 Disconnected: All channels closed

sshd -ddd imprime isso para mim:

login as: username
[email protected]'s password:
Last login: Fri Mar  8 14:36:21 2013 from 127.0.0.1
debug1: permanently_set_uid: 11625/10513
debug3: Copy environment: ALLUSERSPROFILE=C:\ProgramData
debug3: Copy environment: COMPUTERNAME=QTEC0611
debug3: Copy environment: COMSPEC=C:\Windows\system32\cmd.exe
debug3: Copy environment: OS=Windows_NT
debug3: Copy environment: PATH=/cygdrive/c/Program Files/Common Files/Microsoft Shared/Windows Live:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0:/cygdrive/c/Program Files/NTRU Cryptosystems/NTRU TCG Software Stack/bin:/cygdrive/c/Program Files/Wave Systems Corp/Gemalto/Access Client/v5:/cygdrive/c/Program Files/Common Files/Roxio Shared/DLLShared:/cygdrive/c/Program Files/Common Files/Roxio Shared/10.0/DLLShared:/cygdrive/c/Program Files/ActivIdentity/ActivClient:/cygdrive/c/Program Files/Windows Live/Shared:/cygdrive/c/Program Files/QuickTime/QTSystem:/cygdrive/c/Program Files/Microsoft SQL Server/110/Tools/Binn:/cygdrive/c/Program Files/Microsoft SQL Server/110/DTS/Binn:/cygdrive/c/Cygwin/bin:/cygdrive/c/Program Files/PuTTY:/bin
debug3: Copy environment: PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
debug3: Copy environment: PROGRAMFILES=C:\Program Files
debug3: Copy environment: SYSTEMDRIVE=C:
debug3: Copy environment: SYSTEMROOT=C:\Windows
debug3: Copy environment: WINDIR=C:\Windows
Environment:
  ALLUSERSPROFILE=C:\ProgramData
  COMPUTERNAME=QTEC0611
  COMSPEC=C:\Windows\system32\cmd.exe
  OS=Windows_NT
  PATH=/cygdrive/c/Program Files/Common Files/Microsoft Shared/Windows Live:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Windows/System32/WindowsPowerSh
  PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
  PROGRAMFILES=C:\Program Files
  SYSTEMDRIVE=C:
  SYSTEMROOT=C:\Windows
  WINDIR=C:\Windows
  USER=username
  LOGNAME=username
  HOME=/home/username
  MAIL=/var/spool/mail//username
  SHELL=/bin/bash
  SSH_CLIENT=127.0.0.1 52075 22
  SSH_CONNECTION=127.0.0.1 52075 127.0.0.1 22
  SSH_TTY=/dev/pty1
  TERM=xterm

Mas, por algum motivo, não permite que fique conectado? Como faço para solucionar isso?

Aqui está o arquivo de configuração do SSH:

#   $OpenBSD: ssh_config,v 1.26 2010/01/11 01:39:46 dtucker Exp $

# This is the ssh client system-wide configuration file.  See
# ssh_config(5) for more information.  This file provides defaults for
# users, and the values can be changed in per-user configuration files
# or on the command line.

# Configuration data is parsed as follows:
#  1. command line options
#  2. user-specific file
#  3. system-wide file
# Any configuration value is only changed the first time it is set.
# Thus, host-specific definitions should be at the beginning of the
# configuration file, and defaults at the end.

# Site-wide defaults for some commonly used options.  For a comprehensive
# list of available options, their meanings and defaults, please see the
# ssh_config(5) man page.

# Host *
#   ForwardAgent no
#   ForwardX11 no
#   RhostsRSAAuthentication no
#   RSAAuthentication yes
#   PasswordAuthentication yes
#   HostbasedAuthentication no
#   GSSAPIAuthentication no
#   GSSAPIDelegateCredentials no
#   BatchMode no
#   CheckHostIP yes
#   AddressFamily any
#   ConnectTimeout 0
#   StrictHostKeyChecking ask
#   IdentityFile ~/.ssh/identity
#   IdentityFile ~/.ssh/id_rsa
#   IdentityFile ~/.ssh/id_dsa
#   Port 22
#   Protocol 2,1
#   Cipher 3des
#   Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc
#   MACs hmac-md5,hmac-sha1,[email protected],hmac-ripemd160
#   EscapeChar ~
#   Tunnel no
#   TunnelDevice any:any
#   PermitLocalCommand no
#   VisualHostKey no
#   ProxyCommand ssh -q -W %h:%p gateway.example.com

Aqui está o arquivo de configuração do SSHD:

#   $OpenBSD: sshd_config,v 1.87 2012/07/10 02:19:15 djm Exp $

# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/bin:/usr/sbin:/sbin:/usr/bin

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options override the
# default value.

Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

# The default requires explicit activation of protocol 1
#Protocol 2

# HostKey for protocol version 1
#HostKey /etc/ssh_host_key
# HostKeys for protocol version 2
#HostKey /etc/ssh_host_rsa_key
#HostKey /etc/ssh_host_dsa_key
#HostKey /etc/ssh_host_ecdsa_key

# Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 1h
#ServerKeyBits 1024

# Logging
# obsoletes QuietMode and FascistLogging
#SyslogFacility AUTH
#LogLevel INFO

# Authentication:

#LoginGraceTime 2m
#PermitRootLogin yes
StrictModes no
#MaxAuthTries 6
#MaxSessions 10

#RSAAuthentication yes
#PubkeyAuthentication yes

# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
# but this is overridden so installations will only check .ssh/authorized_keys
AuthorizedKeysFile  .ssh/authorized_keys

#AuthorizedPrincipalsFile none

# For this to work you will also need host keys in /etc/ssh_known_hosts
#RhostsRSAAuthentication no
# similar for protocol version 2
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# RhostsRSAAuthentication and HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes

# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
#PermitEmptyPasswords no

# Change to no to disable s/key passwords
#ChallengeResponseAuthentication yes

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

# Set this to 'yes' to enable PAM authentication, account processing, 
# and session processing. If this is enabled, PAM authentication will 
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
#UsePAM no

#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
#X11Forwarding no
#X11DisplayOffset 10
#X11UseLocalhost yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
UsePrivilegeSeparation sandbox      # Default for new installations.
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS yes
#PidFile /var/run/sshd.pid
#MaxStartups 10
#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none

# no default banner path
#Banner none

# override default of no subsystems
Subsystem   sftp    /usr/sbin/sftp-server

# Example of overriding settings on a per-user basis
#Match User anoncvs
#   X11Forwarding no
#   AllowTcpForwarding no
#   ForceCommand cvs server

Não vejo nada em nenhum desses arquivos para explicar o problema. Eles são idênticos ao meu ambiente de trabalho também.

    
por boatcoder 08.03.2013 / 22:08

2 respostas

1

Por alguma razão, isso funcionou para mim quando tive o mesmo problema:

ssh 127.0.0.1 /bin/bash

Mas se bash é o problema, a mesma coisa aconteceria. então, se isso não funcionar, você pode aprender mais apenas tentando executar qualquer comando, por exemplo:

ssh 127.0.0.1 ls

Veja também aqui:

link

Como o Cygwin é executado no Windows, pode ser devido à digitação da tecla enter antes de \ n, significando que "\ r" seria o comando que você está tentando executar em vez de / bin / bash, então ele é executado como script bash e sai. Estou apenas experimentando isso usando o Cygwin no Windows 8.

    
por 15.05.2014 / 07:55
1

Se não estou enganado, no Linux, isso ou algo semelhante pode acontecer se o shell especificado para a conta na qual você está tentando efetuar login for /bin/false , que é uma maneira de impedir que uma conta seja capaz de faça qualquer coisa através de um shell.

Não sei se o sshd do Cygwin verifica /etc/passwd para descobrir qual shell gerar, mas talvez verifique esse arquivo e veja se sua conta está listada ou tente chsh no console e especifique /bin/bash ou similar como o shell.

    
por 31.03.2015 / 03:58