I have a requirement to logon to juniper devices using a port other than ssh 22 - This mean to ssh but using port say 8022 instead.
How do I edit this code or has any one got some examples:
from pprint import pprint
') ** port required is 8022 instead of 22**
from jnpr.junos import Device
from jnpr.junos.utils.start_shell import StartShell
hostname= Device(host='10.1.1.1', user='root', password='test123ss = StartShell(hostname)
ss.open()
hostname.open()
pprint(ss.run('cli -c "show version | no-more"')) # <-- For regular CLI commands
pprint(ss.run('cprod -A fpc0 -c "show route summary"')) # <-- For VTY commands
hostname.close()
ss.close()
Save the above contents as ".py" file and run it using the following command:
python3 filename.py
Device(host='10.1.1.1', user='root', password='test123
',
port=xxx)
Thanks
Nitin Kr
From: <junos-p...@googlegroups.com> on behalf of Taz <tam...@gmail.com>
Date: Thursday, 25 June 2020 at 4:38 PM
To: Junos Python EZ <junos-p...@googlegroups.com>
Subject: Juniper Script how to call Pyez using different ssh port
[External Email. Be cautious of content]
--
You received this message because you are subscribed to the Google Groups "Junos Python EZ" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
junos-python-...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/junos-python-ez/bf3ce68e-6ff5-46a9-8d74-e5f4a47352e8o%40googlegroups.com.
Juniper Business Use Only
Yes, Just checked. StartShell code is using port 22 only. This was done because, PyEZ use 830 port for netconf.
Looks like startShell left it hard coded for 22. We might need to look into this.
To view this discussion on the web visit https://groups.google.com/d/msgid/junos-python-ez/93072931-18d9-47bc-a8ba-a0bd90864948n%40googlegroups.com.
Juniper Business Use Only
Device(host=hostname, user=junos_username, passwd=junos_password, mode='telnet', port='23')
For SSH you can change change mode to SSH and port also.