Putty closes after authentication with public key

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hi guys,

I'm running Putty in Windows 7 32 bits against an OpenSSH server in Windows 2003.  I can login sucessfully using user and pwd authentication, but when I change to RSA I'm not able to do it.

Keys were created using PuttyGen and deployed in the server, in fact, Putty is doing the login but it closes after that without warning.

I can see this in Putty log:


Authenticating with public key "rsa-key-20130925 for Takion SSH server"
Last login: Mon Sep 30 13:09:38 2013 from 210.red-88-26-204.staticip.rima-tde.net


So, I think that login was done sucessfully.

Could you please help me?  

Many thanks

Re: Putty closes after authentication with public key

aramostakion@gmail.com writes:
Quoted text here. Click to load it

What version of PuTTY?

Quoted text here. Click to load it

Try changing "Close window on exit" to "Never", then look at the PuTTY
Event Log (which you can get to from the system menu on the PuTTY
terminal window, or the Ctrl+right-click menu).

Quoted text here. Click to load it

I agree that looks like a successful login (in particular, the "Last
login:" bit looks like the first bit of the login session sent by the

The only thing I can think of offhand, given your symptoms, is a forced
command associated with the key in the server-side configuration that
terminates immediately, but you'd presumably know if you'd set that up.

Re: Putty closes after authentication with public key


Putty version is  release 0.63

Event log:

2013-10-01 16:35:50    Looking up host ""
2013-10-01 16:35:50    Connecting to port 22
2013-10-01 16:35:50    Server version: SSH-2.0-OpenSSH_3.8.1p1
2013-10-01 16:35:50    Using SSH protocol version 2
2013-10-01 16:35:50    We claim version: SSH-2.0-PuTTY_Release_0.63
2013-10-01 16:35:50    Doing Diffie-Hellman group exchange
2013-10-01 16:35:50    Doing Diffie-Hellman key exchange with hash SHA-1
2013-10-01 16:35:50    Host key fingerprint is:
2013-10-01 16:35:50    ssh-rsa 1024 a3:fa:5d:e6:d3:b7:bf:6d:e5:6d:85:61:f2:7d:c7:82
2013-10-01 16:35:50    Initialised AES-256 SDCTR client->server encryption
2013-10-01 16:35:50    Initialised HMAC-SHA1 client->server MAC algorithm
2013-10-01 16:35:50    Initialised AES-256 SDCTR server->client encryption
2013-10-01 16:35:50    Initialised HMAC-SHA1 server->client MAC algorithm
2013-10-01 16:35:50    Reading private key file "D:\Doc_Takion\PuTTy\aramos_TakionSSH.ppk"
2013-10-01 16:35:50    Pageant is running. Requesting keys.
2013-10-01 16:35:50    Pageant has 1 SSH-2 keys
2013-10-01 16:35:50    Pageant key #0 matches configured key file
2013-10-01 16:35:51    Writing new session log (raw mode) to file: D:\Doc_Takion\PuTTy\putty.log
2013-10-01 16:35:51    Trying Pageant key #0
2013-10-01 16:35:51    Sending Pageant's response
2013-10-01 16:35:51    Access granted
2013-10-01 16:35:51    Opening session as main channel
2013-10-01 16:35:52    Opened main channel
2013-10-01 16:35:52    Allocated pty (ospeed 38400bps, ispeed 38400bps)
2013-10-01 16:35:52    Started a shell/command
2013-10-01 16:35:52    Server sent command exit status 255
2013-10-01 16:36:02    Disconnected: All channels closed

Server is  OpenSSh but I didn't set any command associated with the key :(

Do you know what thing could be happening?


Re: Putty closes after authentication with public key

Server event viewer has this info:

Event Type:    Error
Event Source:    sshd
Event Category:    None
Event ID:    0
Date:        01/10/2013
Time:        16:35:53
Computer:    CD75665
The description for Event ID ( 0 ) in Source ( sshd ) cannot be found. The  
local computer may not have the necessary registry information or message D
LL files to display messages from a remote computer. You may be able to use
 the /AUXSOURCE= flag to retrieve this description; see Help and Support  
for details. The following information is part of the event: sshd : PID 230
0 : fatal: setreuid 1011: Permission denied.

Re: Putty closes after authentication with public key

aramostakion@gmail.com writes:
 [PuTTY log]
Quoted text here. Click to load it

 [and on the server]
Quoted text here. Click to load it
Quoted text here. Click to load it

That convinces me that the problem is on the server, but I've no idea
why that might be happening.

It looks like you're running your SSH server on Windows? Could it be
something like, the SSH server is unable to start a session as the
relevant user without having the user's actual credentials (password) in
hand? (Complete guess; I have no experience running an SSH server on

Re: Putty closes after authentication with public key

On Monday, September 30, 2013 4:47:45 PM UTC+5:30, aramos...@gmail.com wrote:
Quoted text here. Click to load it

Can anyone please help me write a script which logs in to a putty session and enters username and password and then execute commands?  

I am half way through . I have written following .bat script  
@echo off
start C:\User\XYZ\Desktop\putty.exe -load "session" -l "username" -pw "password";  
But it closes after authenticating.
Please help me in the above issue and also a way to execute commands automatically after loggin in.

Thanks in advance.

Site Timeline