Categories
python

Python HTTP.server

Intro (the issue)

What is required I need to get a config cloud-config.yml file onto the directory /var/lib/rancher/conf (Rancher OS) on a server which has network access but I don’t have SSH access to SCP the file across why this is how you set up a public SSH key and can do all sorts of configuration please see link for more?

What are the options

  1. Use a Git/GitLab for storing the cloud-config.yml and pull of HTTPS sound good but I don’t have this set up yet and this is only a lab so may rip it apart at any point so not needed could use public hosted as it is my ssh public key but still don’t want to do that.
  2. Set up an SFTP/SCP and pull it across to the server (not sure it supports this also I like fewer holes in my firewall) the best option
  3. As I am on the same lab network I could use a nice feature of python shame its only HTTP to share a directory with the cloud-config.yml also I get to use python (one line but still)

Set Up The Python Simple HTTP Server

  1. Create a directory
  2. Create the file you want to share in that directory
  3. Open up a terminal navigate to that directory
  4. Type the command below now you can access a HTTP server on http://x.x.x.x:8080 and that is it
python.exe -m http.server 8080
  1. Ctrl+C to exit and close the server job done

Leave a Reply

Your email address will not be published.