[Tutor] run local script on a remote machine

Alex Kleider akleider at sonic.net
Thu Oct 27 12:46:55 EDT 2016


On 2016-10-27 00:22, Cameron Simpson wrote:
> On 26Oct2016 10:44, Alex Kleider <akleider at sonic.net> wrote:
>> command = (
>> "ssh -p22 alex at 10.10.10.10 python3 -u - one two three < {}"
>>    .format(script))
>> ret = subprocess.call(shlex.split(command))
> 
> This is not fine.
..........
>  http://bobby-tables.com/

Thanks for the warning.  I'm aware of the injection problem and should 
have mentioned that the code exposed itself to this only because I was 
trying to make it as short as possible to demonstrate the problem.

> 
> The second problem, and the one causing your immediate issue, is the
> use of shlex.split.

Eliminating it made things work as desired.

> Hoping this clarifies what's going on and how to go forward.

It does that indeed.  Thank you very much.

> Please feel free to ask any questions that occur.

Also gratitude to you and the others on this list that are so generous 
with your advice.

Sincerely,
Alex


More information about the Tutor mailing list