Welcome to my journey of continuous discovery. Enjoy your visit.

Ugli Scripting
Ugli Scripting
  • Home
  • Blog
  • .PY
    • Python 2.7 on Windows
    • Python 2.7 on Ubuntu
    • Python 2.7 IDE Set up
    • Run Python Script via CLI
    • Adding Python Packages
    • Basic REST API
  • .PS1
    • Install AD Module Win 10
    • Connecting to MSO and EOP
    • Storing Script Variables
    • Storing Secure Strings
    • Storing User Credentials
    • Basic REST API
  • Sample Integrations
    • Isolate SEP Clients
    • Force Password Change
    • o365 Account Remediation
    • Threat Response Lists
    • Endpoint Scripts
  • SITQ Lab
    • Lab Resources
    • AD Lab Account Imports
    • DLP Sample
  • More
    • Home
    • Blog
    • .PY
      • Python 2.7 on Windows
      • Python 2.7 on Ubuntu
      • Python 2.7 IDE Set up
      • Run Python Script via CLI
      • Adding Python Packages
      • Basic REST API
    • .PS1
      • Install AD Module Win 10
      • Connecting to MSO and EOP
      • Storing Script Variables
      • Storing Secure Strings
      • Storing User Credentials
      • Basic REST API
    • Sample Integrations
      • Isolate SEP Clients
      • Force Password Change
      • o365 Account Remediation
      • Threat Response Lists
      • Endpoint Scripts
    • SITQ Lab
      • Lab Resources
      • AD Lab Account Imports
      • DLP Sample

  • Home
  • Blog
  • .PY
    • Python 2.7 on Windows
    • Python 2.7 on Ubuntu
    • Python 2.7 IDE Set up
    • Run Python Script via CLI
    • Adding Python Packages
    • Basic REST API
  • .PS1
    • Install AD Module Win 10
    • Connecting to MSO and EOP
    • Storing Script Variables
    • Storing Secure Strings
    • Storing User Credentials
    • Basic REST API
  • Sample Integrations
    • Isolate SEP Clients
    • Force Password Change
    • o365 Account Remediation
    • Threat Response Lists
    • Endpoint Scripts
  • SITQ Lab
    • Lab Resources
    • AD Lab Account Imports
    • DLP Sample

Running a Python Script on Ubuntu

Moving Scripts between Windows and Ubuntu

We created a simple script called what-python-version.py during our IDE configuration.  We are going to move the file to our Ubuntu system and see if it runs.


Open PowerShell on Windows and navigate to your script directory.  Follow along with the commands in the screenshot above.


Steps:

  1. Run A Python script locally inside Windows PowerShell
  2. Use SCP to copy script to Ubuntu
  3. SSH to Ubuntu
  4. Run the script on Linux

Note how easy it was to run Python inside PowerShell.  This capability will allows you to call Python scripts from within you PowerShell scripts.

If you need an SSH or SCP refresher, check out the links below

Wikipedia


Secure Copy Protocol or SCP


Secure Shell of SSH

Some additional background on script interoperability.

One of the great things about Python is you can move scripts between platforms most of the time. We will cover this topic in more detail when I make it to uploading a Project I completed to force AD Users to change their passwords at next logon leveraging a user list hosted within a security Application.


There are lots of Python packages that rely on Windows components. Therefore, they will fail on Ubuntu.


With a JetBrains subscription you can run multiple copies of their IDEs. It can be helpful to run both Windows and Mac versions of the tools.

Copyright © 2018 Ugli Scripting - All Rights Reserved.

  • Blog
  • CV

Powered by GoDaddy