Description

This article describes why SSH to a switching device may fail with the error "Server refused to allocate pty" and what must be done to resolve the error.

Symptoms

SSH to the device will work but after providing login credentials, the SSH connection gets terminated with the message "​Server refused to allocate pty" for the Putty session. Further, no response is seen to the SecureCRT session.

The following log messages will be seen if you connect via the Console:

----------------------------------------------------------------------------------------
ssh[2467]: PTY allocation request failed on channel 0
ssh[2467]: shell request failed on channel 0
----------------------------------------------------------------------------------------

Solution

In this case, SSH fails because of the following netconf ssh port 22 configuration:

root@JNPR> show configuration system services netconf
ssh {
    port 22;
}
{master:0}
root@JNPR> 

To resolve the issue, you can perform the following steps:

Step 1: You have two options for this step and you can perform either one.

  • Option 1: From the system services netconf ssh stanza, you can remove port 22 as follows:

root@JNPR# show | compare
[edit system services netconf ssh]
-     port 22;
{master:0}[edit]
root@JNPR#
OR
  • Option 2: You can configure a different port than port 22 depending on the netconf device configuration.

root@JNPR# show | compare
[edit system services netconf ssh]
-     port 22;
+     port 830;
{master:0}[edit]
root@JNPR#

Step 2

  • Deactivate and activate system services netconf .

root@JNPR# deactivate system services netconf
root@JNPR# show | compare     
[edit system services]
!     inactive: netconf { ... }
 
{master:0}[edit]
root@JNPR# commit
configuration check succeeds
commit complete
 
{master:0}[edit]
root@JNPR# activate system services netconf
root@JNPR# commit
configuration check succeeds
commit complete
 
{master:0}[edit]
root@JNPR#