📄 SKILL.md

← Vault

name: vps-python-script-deploy

description: Write Python script locally, SCP to VPS, execute — bypass bash interpretation issues when patching remote files

category: devops


VPS Python Script Deploy — bypass bash interpretation

Problem

When trying to run Python scripts via sshpass ssh ... "python3 - << 'EOF' ...", bash interprets Python content as shell commands (backticks, $, etc.), causing syntax errors.

Solution

Write the Python script locally, SCP it to the VPS, then execute it:

`bash

sshpass -p 'PASSWORD' scp -o StrictHostKeyChecking=no /tmp/script.py root@VPS:/tmp/script.py

sshpass -p 'PASSWORD' ssh -o StrictHostKeyChecking=no root@VPS "python3 /tmp/script.py"

`

Why this works