[paramiko] paramiko
James Bardin
jbardin at bu.edu
Wed Apr 4 09:45:26 PDT 2007
Using python will give you more flexibility than the shell.
With the shell it may be difficult to tell when your variables are being
resolved.
For example, your second statement is interpreted by bash as:
ssh root@$target { s=blabla; touch /tmp/}
because the variables are evaluated immediately. Bash uses a single
quotes ' ' for strings that should not be evaluated.
Paramiko is just an implementation of ssh for python, so it's not a
matter of paramiko being able to do this, it's the information passed to
the shell at the other end that's important. In your python script, you
can build the exact command you want executed on the remote machine as a
string, and send that command using ssh/paramiko.
-jim
Tessier AtosOrigin wrote:
> Thanks for your reply James.
>
> Yes, this is a good alternative to locate the script on a network
> ressource and push machines to execute it.
>
> The bash scripts i use do the whole thing but it's not gonna be
> sustainable for larger stuff.
>
>
> With the shell, you can do this kind of thing :
>
> sys="`ssh root@$cible "{
> cat /etc/redhat-release
> }"`"
>
> however you can't do this :
>
> ssh root@$target "{
> s="blabla"
> touch /tmp/$s
> }"
>
> it seems you can't use variables...
>
> Do you think paramiko can do it?
>
>
> could you please send attachements (sources and binaries) do this adress :
>
> g_tessier_fr at yahoo.fr
>
> Bye
>
> Guillaume TESSIER
> Philips - PGIS Hosting
> 51 rue Carnot - 92150 Suresnes
> tel : 01 47 28 (14 13)
> mobile : 06 66 80 26 38
> Email : tessier.atosorigin at philips.com
>
--
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
James Bardin - Systems Analyst / Administrator I
Boston University Department of Electrical and Computer Engineering
8 Saint Mary's St, Room 305, Boston, MA 02215
Ph:617-358-2785 http://www.bu.edu/ece/it
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
More information about the paramiko
mailing list