# Putty closes when entering user name

## kikr

I'm trying to remotely connect to my home box via ssh using putty.

When I used to do this before everything worked fine, however, now all of a sudden after I enter my username putty's terminal screen just closes.  I know it's not the client-side's problem because I tried connecting to a different server and it worked.  Any suggestions?

----------

## texas1emt

I had a similar problem with a stage 3 install when I first began using Gentoo. Post your /etc/ssh/sshd_config (or maybe about the first 15-20 lines).

To fix the problem for me, I had to add a line or two:

```
# My gentoo box is 192.168.10.50

ListenAddress 192.168.10.50

Port 22
```

----------

## kikr

Port 44

Protocol 2

#ListenAddress 0.0.0.0

#ListenAddress ::

I'm going to try the following:

ListenAddress *

or

ListenAddress my_ip

----------

## texas1emt

Oof, yeah, the * wildcard is a good idea too.   :Wink: 

----------

## battra

Hmmm, this is interesting.  I just recently started having the same issue, too.   Putty just closes when entering the username.  But, if I open Putty again and try, it works fine.  Haven't had time to investigate.  I was assuming it was maybe a client-side issue.  But now, I'm not so sure.

Just thought I'd share.  I'd be interested in knowing if changing ListenAddress works for you.

----------

## nobspangle

I sometimes have this problem if I have loaded up paegent but the server I am trying to access does not support public key authetication.

----------

## kikr

I'm still having the problem with connecting.  When I was at home I tried connecting to my gentoo box from within the same LAN and it worked, however, when connecting from a different remote location PuTTY closes as soon as I enter my username.  At the bottom of PuTTy's setup window I changed 'Close window on exit:' to 'Never'.  After doing this I tried again and now I get an error-dialog-popup-window after entering my username.  The error was: "Connection closed by remote host".  I'm not at home so I can't troubleshoot the problem right now.  Does anyone know if there is an option in the SSH config file(s) to allow/disallow certain IP's from connecting?

----------

## texas1emt

 *kikr wrote:*   

> Does anyone know if there is an option in the SSH config file(s) to allow/disallow certain IP's from connecting?

 

Are you trying to connect as root?  If you have PermitRootLogin set to 'yes' then it will take your user + pass and then kick you off if you attempt to login as root.

The other thing you might want to try is (the dreaded) webmin where you can set some sshd settings that I don't quite have the syntax for.

Double check your LoginGraceTime and try deleting your ssh keys off the server.  After removing the keys, restart SSHD and it will create new keys.  Also, check PasswordAuthentication (should be yes).  If that's set to no, then SSHD will expect a key to grant you access and it won't handle passwords.  You could try making a line like 'AllowUsers yourusername' in your /etc/ssh/sshd_config to force SSHD to accept your username.

Another good resource is the SSHD_CONFIG man page.

----------

## j-m

Did you try to restart sshd?  :Idea: 

----------

## thecooptoo

looks like Im having the same problem.

I can connect as root , but not as a user ( apache in this case)

putty generated log 

```
=~=~=~=~=~=~=~=~=~=~=~= PuTTY log 2005.02.14 14:26:12 =~=~=~=~=~=~=~=~=~=~=~=

login as: apache

apache@62.130.12.202's password: 

Last login: Mon Feb 14 2005 13:05:41 from 10.138.8.77

No mail.
```

```
NTGHICU1 root # tail -n 15 /var/log/messages

Feb 14 14:53:07 NTGHICU1 sshd[1998]: Daemon is running.

Feb 14 14:53:29 NTGHICU1 sshd[1998]: connection from "10.138.8.77"

Feb 14 14:53:29 NTGHICU1 sshd[2001]: WARNING: DNS lookup failed for "10.138.8.77".

Feb 14 14:53:37 NTGHICU1 sshd[2001]: User apache's local password accepted.

Feb 14 14:53:37 NTGHICU1 sshd[2001]: Password authentication for user apache accepted.

Feb 14 14:53:37 NTGHICU1 sshd[2001]: User apache, coming from 10.138.8.77, authenticated.

Feb 14 14:53:37 NTGHICU1 sshd2[2003]: Now running on apache's privileges.

Feb 14 14:53:37 NTGHICU1 sshd[2001]: Local disconnected: Connection closed.

Feb 14 14:53:37 NTGHICU1 sshd[2001]: connection lost: 'Connection closed.'

Feb 14 14:54:46 NTGHICU1 sshd[1998]: connection from "10.138.8.77"

Feb 14 14:54:46 NTGHICU1 sshd[2005]: WARNING: DNS lookup failed for "10.138.8.77".

Feb 14 14:54:58 NTGHICU1 sshd[2005]: User root's local password accepted.

Feb 14 14:54:58 NTGHICU1 sshd[2005]: Password authentication for user root accepted.

Feb 14 14:54:58 NTGHICU1 sshd[2005]: User root, coming from 10.138.8.77, authenticated.

Feb 14 14:54:58 NTGHICU1 sshd2[2007]: Now running on root's privileges.

```

it would seem that user /password is OK then it disconnects . No idea why

Im aiming to use winscp to connect to my gentoo box, but winscp closes the connection as well

----------

## UberLord

Does the user have a valid shell?

```
getent passwd | grep apache
```

I had a similar issue and it was because my openldap ACL didn't allow the return of loginShell back to generic queries

----------

## kikr

Try deleting your RSA key files then restart SSHD.  SSHD should regenerate the files.  After doing so I can login in remotely.

This is the code I used:

```
rm -i /etc/ssh/ssh_host_rsa_key ssh_host_rsa_key.pu

/etc/init.d/sshd restart
```

----------

## thecooptoo

I had used webmin to change the user credentials and it had created another apache user, who  did have a shell acount, the original did not.

It would appear that /etc/passwd is read from the top and then it stops when it finds a match ( in my case ,no shell)

Webmin displays the credentials of the last username it finds in /etc/passwd.- ie the one with with a shell

----------

## j-m

 *thecooptoo wrote:*   

> I had used webmin to change the user credentials and it had created another apache user, who  did have a shell acount, the original did not.
> 
> It would appear that /etc/passwd is read from the top and then it stops when it finds a match ( in my case ,no shell)
> 
> Webmin displays the credentials of the last username it finds in /etc/passwd.- ie the one with with a shell

 

First if all, I don´t understand how can webmin add already existing user. This is a pretty serious bug in webmin! Don´t use such buggy crap to manage users, there is no reason to do so...  :Evil or Very Mad: 

P.S. You should verify and then report this webmin bug...

----------

