cisco — Example: Managing the Guest Shell

In Releases Prior to Cisco IOS XE Amsterdam 17.3.1 The guestshell run command is the Cisco IOS equivalent of running Linux executables, and when running a Python script from Cisco IOS, specify the absolute path. The following example shows how to specify the absolute path for the command: Guestshell run python /flash/guest-share/sample_script.py parameter1 parameter2 The following example shows how to enable Python on a Cisco Catalyst 3650 Series Switch or a Cisco Catalyst 3850 Series Switch: Device# guestshell run python Python 2.7.11 (default, March 16 2017, 16:50:55) [GCC 4.7.0] on linux2 Type "help", "copyright", "credits" or "license" for more information.

>>>>> The following example shows how to enable Python on a Cisco ISR 4000 Series Integrated Services Router: Device# guestshell run python Python 2.7.5 (default, Jun 17 2014, 18:11:42) [GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>>>> In Cisco IOS XE Amsterdam 17.3.1 and Later Releases The following example shows how to enable Python on Cisco Catalyst 9000 Series Switches:

Device# guestshell run python3 Python 3.6.8 (default, Nov 21 2019, 22:10:21) [GCC 8.3.1 20190507 (Red Hat 8.3.1-4)] on linux Type "help", "copyright", "credits" or "license" for more information.>>>>> Configuration Examples for the Guest Shell Example: Managing the Guest Shell In Cisco IOS XE Amsterdam 17.1.x to Cisco IOS XE Amsterdam 17.2.x The following example shows how to enable Guest Shell. In Cisco IOS XE Amsterdam 17.1.x and Cisco IOS XE Amsterdam 17.2.x, both Python V2.7 and Python V3.6 are supported. However, Python V2.7 is the default in these releases. Device> enable Device# guestshell enable Guest Shell Configuration Examples for the Guest Shell Guest Shell 21