-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automatic Newline b'\n' ConnectHandler #3481
Comments
Can you post the Python code that corresponds to the above log file? Also can you post the full Python exception stack trace? |
from netmiko import ConnectHandler, redispatch ssh_net = dict(device_type='autodetect', ip=IP, username=username, password=password, port=port) connection = ConnectHandler(**ssh_net) This section node_name can be ignored as i am retrieving it from an excel sheet with hostnames and IP Addresses (Pandas)node_name = ([k for k, v in n_result_df.items() if v == node_ip]) neu_user = input("New User SSH: ").strip() if neu_user: So far so goodwhile True:
except Exception as e: """All of this is the section that is causing problems. I dont believe it is a Netmiko Problem. #Thanks in advance Kirk for your time. Again it is not a Problem in Netmiko. Just to know your perspective, how would you #solve this kind of problem with Netmiko, if it can be solved. I tried every way possible. without While loop, other device types, LOG: DEBUG:netmiko:read_channel: |
Hello Kirk. Hope you are doing well. I was able to do it, with a mix of netmiko and paramiko. The step that needed that new password to be entered and then confirmed works with paramiko:
That means that i am doing everything through Netmiko and when the scripts needs to login with the new user, paramiko will do the job to at least enter the new pass. The rest, if needed, will be done with Netmiko. I dont see exactly how paramiko dealt with it. Can i log the paramiko session like in Netmiko? Anyway thanks for your help Kirk and for Netmiko. |
SSH Session closed if write channel b'\n'.
Setup
Netmiko 4.3.0
device_type='autodetect' =>(works best with Nokia ISAM devices)
Hello first and foremost. Thanks fo your amazing work on Netmiko.
Now this isn´t a python per si problem, or even the ConnectHandler itself.
It´s more a question about the log below:
"""
DEBUG:paramiko.transport:userauth is OK
INFO:paramiko.transport:Auth banner: b'\n\n'
INFO:paramiko.transport:Authentication (password) successful!
DEBUG:paramiko.transport:[chan 0] Max packet in: 32768 bytes
DEBUG:paramiko.transport:[chan 0] Max packet out: 4096 bytes
DEBUG:paramiko.transport:Secsh channel 0 opened.
DEBUG:paramiko.transport:[chan 0] Sesch channel 0 request ok
DEBUG:paramiko.transport:[chan 0] Sesch channel 0 request ok
DEBUG:netmiko:write_channel: b'\n'
DEBUG:netmiko:read_channel:
DEBUG:paramiko.transport:[chan 0] EOF sent (0)
DEBUG:paramiko.transport:EOF in transport thread
DEBUG:netmiko:read_channel:
Welcome to ****
Your password is expired !
enter new password:
DEBUG:netmiko:read_channel:
"""
Where in normal circunstances i can with device_type=autodetect manage these devices no problem.
This thype of workflow on the other hand, creating new user has an interesting problem with it:
"As long as Netmiko automatically writes the channel with b'\n' it isnt possible to deal with the prompts that come right after login.
That is because the devices strangely close the session imediatelly if newline (Enter) is given after the login.
I tried everything under the sun with device_type=terminal_server and multiple changes on the BaseConnection to try avoiding this netmiko:write_channel: b'\n' on the session but without success. Should i give up (just use Paramiko) or is there something i can do about this with netmiko unknown to me? I need Basically a Session where no newline with be given from netmiko. At least until i manage that prompt for pass expired.
Thanks in advance for your response and support.
The text was updated successfully, but these errors were encountered: