LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Server refused to allocate pty => error cygwin putty.exe murugesandins@127.0.0.1 (https://www.linuxquestions.org/questions/linux-newbie-8/server-refused-to-allocate-pty-%3D-error-cygwin-putty-exe-murugesandins%40127-0-0-1-a-4175736073/)

murugesandins 04-16-2024 05:07 AM

Server refused to allocate pty => error cygwin putty.exe murugesandins@127.0.0.1
 
I am not able to login using putty.exe to
murugesandins@127.0.0.1
It is reporting following error:
Server refused to allocate pty
Using bash.exe at command prompt:
=========
murugesandins@127.0.0.1 /home/murugesandins [ 0 ]
$ /usr/bin/ssh murugesandins@127.0.0.1
PTY allocation request failed on channel 0
murugesandins@127.0.0.1 OS Microsoft Windows 11 Single Language, 64-bit (build 22631)
Last logon Tue 16-Apr-2024 03:33 PM
/home/murugesandins
Connection to 127.0.0.1 closed.
===============
I faced this issue 3 weeks ago
Re-installed sshd
and daily restart for more than 10 days it resolved
How can I resolve at localhost?
a)
$ grep TTY /etc/sshd_config
#PermitTTY yes
not working after restarting system and sshd service
b)
$ grep TTY /etc/sshd_config
PermitTTY yes
not working after restarting system and sshd service


$ grep -v "^$|#" /etc/sshd_config
Port 22
ListenAddress 127.0.0.1
AuthorizedKeysFile .ssh/authorized_keys
Subsystem sftp /usr/sbin/sftp-server
$ /usr/bin/ls -d ~/.ssh/authorized_keys
/home/murugesandins/.ssh/authorized_keys
I have tried with and without .ssh (including sc stop sc start sshd service and re-starting windows 11)
it is of no use.

I have tried using following sshd versions(which is of no use)
OpenSSH_9.5p1, OpenSSL 3.0.13 30 Jan 2024
OpenSSH_9.6p1, OpenSSL 3.0.13 30 Jan 2024
OpenSSH_9.7p1, OpenSSL 3.0.13 30 Jan 2024

$ openssl.exe version
OpenSSL 3.0.13 30 Jan 2024 (Library: OpenSSL 3.0.13 30 Jan 2024)

murugesandins 04-16-2024 09:00 AM

#!/bin/bash
echo any shell script using automation at cygwin
I have tried following steps to resolve this issue(but not yet resolved)
1) sc stop cygwin sshd service
2) sc delete cygwin sshd service
3) taskill /f /im bash.exe
to kill automation alert using notepad.exe to remove or add battery alert at laptop if reaching 25% or 98%
4) sc stop exim
and verifiy that startup type is manual
5) I do not have any sendmail service
6) move cygwin directory to cygwin_backup10
7) setup-x86_64.exe --no-admin
download and install openssh at new cygwin directory
include bc.exe and vim.exe during installations
8) move openssl.exe which I have compiled earlier to /usr/bin/ directory to resolve
openssl speed -multi 900000000
bug
I have tested all these steps without replacing existing openssl.exe file.
9) install cygwin sshd service
10)
relogin using putty.exe
which is reporting same error:
Server refused to allocate pty
11)
same error if using
cmd.exe => bash.exe => ssh murugesandins@127.0.0.1
PTY allocation request failed on channel 0

Code:

$ /usr/bin/ssh -vv murugesandins@127.0.0.1
OpenSSH_9.7p1, OpenSSL 3.0.13 30 Jan 2024
debug1: Reading configuration data /etc/ssh_config
debug2: resolve_canonicalize: hostname 127.0.0.1 is address
debug1: Connecting to 127.0.0.1 [127.0.0.1] port 22.
debug1: Connection established.
debug1: identity file /home/murugesandins/.ssh/id_rsa type -1
debug1: identity file /home/murugesandins/.ssh/id_rsa-cert type -1
debug1: identity file /home/murugesandins/.ssh/id_ecdsa type -1
debug1: identity file /home/murugesandins/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/murugesandins/.ssh/id_ecdsa_sk type -1
debug1: identity file /home/murugesandins/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /home/murugesandins/.ssh/id_ed25519 type -1
debug1: identity file /home/murugesandins/.ssh/id_ed25519-cert type -1
debug1: identity file /home/murugesandins/.ssh/id_ed25519_sk type -1
debug1: identity file /home/murugesandins/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /home/murugesandins/.ssh/id_xmss type -1
debug1: identity file /home/murugesandins/.ssh/id_xmss-cert type -1
debug1: identity file /home/murugesandins/.ssh/id_dsa type -1
debug1: identity file /home/murugesandins/.ssh/id_dsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_9.7
debug1: Remote protocol version 2.0, remote software version OpenSSH_9.7
debug1: compat_banner: match: OpenSSH_9.7 pat OpenSSH* compat 0x04000000
debug2: fd 4 setting O_NONBLOCK
debug1: Authenticating to 127.0.0.1:22 as 'murugesandins'
debug1: load_hostkeys: fopen /home/murugesandins/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh_known_hosts2: No such file or directory
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal
debug2: KEX algorithms: sntrup761x25519-sha512@openssh.com,curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,ext-info-c,kex-strict-c-v00@openssh.com
debug2: host key algorithms: ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,rsa-sha2-512,rsa-sha2-256
debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,zlib@openssh.com,zlib
debug2: compression stoc: none,zlib@openssh.com,zlib
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: sntrup761x25519-sha512@openssh.com,curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,ext-info-s,kex-strict-s-v00@openssh.com
debug2: host key algorithms: rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519
debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,zlib@openssh.com
debug2: compression stoc: none,zlib@openssh.com
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug1: kex: algorithm: sntrup761x25519-sha512@openssh.com
debug1: kex: host key algorithm: ssh-ed25519
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: SSH2_MSG_KEX_ECDH_REPLY received
debug1: Server host key: ssh-ed25519 SHA256:JXJHPMIcj3eDaKAzpXp7DJ2fXqqWx4JJP4xOuMcbcnI
debug1: load_hostkeys: fopen /home/murugesandins/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh_known_hosts2: No such file or directory
debug1: Host '127.0.0.1' is known and matches the ED25519 host key.
debug1: Found key in /home/murugesandins/.ssh/known_hosts:1
debug1: ssh_packet_send2_wrapped: resetting send seqnr 3
debug2: ssh_set_newkeys: mode 1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: Sending SSH2_MSG_EXT_INFO
debug1: expecting SSH2_MSG_NEWKEYS
debug1: ssh_packet_read_poll2: resetting read seqnr 3
debug1: SSH2_MSG_NEWKEYS received
debug2: ssh_set_newkeys: mode 0
debug1: rekey in after 134217728 blocks
debug2: KEX algorithms: sntrup761x25519-sha512@openssh.com,curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,ext-info-c,kex-strict-c-v00@openssh.com
debug2: host key algorithms: ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,rsa-sha2-512,rsa-sha2-256
debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,zlib@openssh.com,zlib
debug2: compression stoc: none,zlib@openssh.com,zlib
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_ext_info_client_parse: server-sig-algs=<ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,rsa-sha2-512,rsa-sha2-256>
debug1: kex_ext_info_check_ver: publickey-hostbound@openssh.com=<0>
debug1: kex_ext_info_check_ver: ping@openssh.com=<0>
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_ext_info_client_parse: server-sig-algs=<ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,rsa-sha2-512,rsa-sha2-256>
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Will attempt key: /home/murugesandins/.ssh/id_rsa
debug1: Will attempt key: /home/murugesandins/.ssh/id_ecdsa
debug1: Will attempt key: /home/murugesandins/.ssh/id_ecdsa_sk
debug1: Will attempt key: /home/murugesandins/.ssh/id_ed25519
debug1: Will attempt key: /home/murugesandins/.ssh/id_ed25519_sk
debug1: Will attempt key: /home/murugesandins/.ssh/id_xmss
debug1: Will attempt key: /home/murugesandins/.ssh/id_dsa
debug2: pubkey_prepare: done
debug1: Trying private key: /home/murugesandins/.ssh/id_rsa
debug1: Trying private key: /home/murugesandins/.ssh/id_ecdsa
debug1: Trying private key: /home/murugesandins/.ssh/id_ecdsa_sk
debug1: Trying private key: /home/murugesandins/.ssh/id_ed25519
debug1: Trying private key: /home/murugesandins/.ssh/id_ed25519_sk
debug1: Trying private key: /home/murugesandins/.ssh/id_xmss
debug1: Trying private key: /home/murugesandins/.ssh/id_dsa
debug2: we did not send a packet, disable method
debug1: Next authentication method: keyboard-interactive
debug2: userauth_kbdint
debug2: we sent a keyboard-interactive packet, wait for reply
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug2: we did not send a packet, disable method
debug1: Next authentication method: password
murugesandins@127.0.0.1's password:
debug2: we sent a password packet, wait for reply
Authenticated to 127.0.0.1 ([127.0.0.1]:22) using "password".
debug1: channel 0: new session [client-session] (inactive timeout: 0)
debug2: channel 0: send open
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: pledge: filesystem
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
debug1: client_input_hostkeys: searching /home/murugesandins/.ssh/known_hosts for 127.0.0.1 / (none)
debug1: client_input_hostkeys: searching /home/murugesandins/.ssh/known_hosts2 for 127.0.0.1 / (none)
debug1: client_input_hostkeys: hostkeys file /home/murugesandins/.ssh/known_hosts2 does not exist
debug1: client_input_hostkeys: no new or deprecated keys from server
debug2: channel_input_open_confirmation: channel 0: callback start
debug2: fd 4 setting TCP_NODELAY
debug2: client_session2_setup: id 0
debug2: channel 0: request pty-req confirm 1
debug2: channel 0: request shell confirm 1
debug1: pledge: fork
debug2: channel_input_open_confirmation: channel 0: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel_input_status_confirm: type 100 id 0
PTY allocation request failed on channel 0
debug2: channel 0: rcvd adjust 2097152
debug2: channel_input_status_confirm: type 99 id 0
debug2: shell request accepted on channel 0
TODAY birthday to KAVITHA.
|06 | dd: 18 Open MIS ON 18-Mar-2024 CURRENT OPENED MIS COUNT 1
Last logon                  Thu 18-Apr-2024 07:51 AM
exit
debug2: channel 0: rcvd ext data 35
TERM environment variable not set.
debug2: channel 0: written 35 to efd 7
debug2: channel 0: rcvd eof
debug2: channel 0: output open -> drain
debug2: channel 0: obuf empty
debug2: chan_shutdown_write: channel 0: (i0 o1 sock -1 wfd 6 efd 7 [write])
debug2: channel 0: output drain -> closed
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype eow@openssh.com reply 0
debug2: channel 0: rcvd eow
debug2: chan_shutdown_read: channel 0: (i0 o3 sock -1 wfd 5 efd 7 [write])
debug2: channel 0: input open -> closed
debug2: channel 0: rcvd close
debug2: channel 0: almost dead
debug2: channel 0: gc: notify user
debug2: channel 0: gc: user detached
debug2: channel 0: send close
debug2: channel 0: is dead
debug2: channel 0: garbage collecting
debug1: channel 0: free: client-session, nchannels 1
Connection to 127.0.0.1 closed.
Transferred: sent 3616, received 4204 bytes, in 38.7 seconds
Bytes per second: sent 93.3, received 108.5
debug1: Exit status 0

Code:

$ ssh-keygen -t rsa -f ~/.ssh/id_rsa -b 2048 -N ""
Generating public/private rsa key pair.
Your identification has been saved in /home/murugesandins/.ssh/id_rsa
Your public key has been saved in /home/murugesandins/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:GOUozf7lTG5pTSUjsIw7qfJND2WUZ4rSsMLZXmGsmOA murugesandins@127.0.0.1
The key's randomart image is:
+---[RSA 2048]----+
|      . oo.      |
|.    o *.+o      |
|o.  ..+ C++ .    |
|.E. .o+=.. +    |
| . ++*.oM .      |
|  +.=o+  +      |
|. .ooo  + o      |
| o o.o *..      |
|  . . .o=        |
+----[SHA256]-----+
$ cp .ssh/id_rsa.pub .ssh/authorized_keys
$ cp .ssh/id_rsa.pub .ssh/authorized_keys2
murugesandins@127.0.0.1 /home/murugesandins [ 0 ]
$ /usr/bin/ssh murugesandins@127.0.0.1 /usr/bin/pwd
murugesandins@127.0.0.1's password:
Last logon                  Thu 18-Apr-2024 08:00 AM
/home/murugesandins
murugesandins@127.0.0.1 /home/murugesandins [ 0 ]
$ #ssh -vv using same error

Initially using ssh.exe inside cmd.exe was having following error:
Ignored authorized keys: bad ownership or modes for directory /home/murugesandins
chmod 700 ~/ ~/.ssh
resolved "Ignored authorized keys: bad ownership or modes for directory" error and not:
Server refused to allocate pty
error

a)
Removed /usr/bin/[.exe
b)
Replaced /usr/bin/clear.exe using:
#!/bin/bash
echo -ne "\033[H\033[J"

murugesandins 04-18-2024 01:45 AM

Hi LQ,

After reboot and relogin at:
Thu 18-Apr-2024 12:12 PM
putty.exe is working fine.
Hence I am making this issue as resolved.
If any person came to know to resolve this feature without reinstall/relogin they can share the same here in future.


All times are GMT -5. The time now is 03:22 AM.