OS specific command in Python

Jon Ribbens jon+usenet at unequivocal.co.uk
Wed Jun 21 09:41:12 EDT 2006


In article <1150783324.258644.65770 at u72g2000cwu.googlegroups.com>, stephanearnold at yahoo.fr wrote:
>> So basically, instead of typing in on the command line argument I want
>> to have it in a python program and let it do the action.
> 
> Try exec() and execfile() from the standard library (IIRC)

Ths os.spawn...() functions are likely to be better suited to what he
wants to do.

>> ssh Admin at 192.168.2.10          .....etc
> 
> When you connect (via ssh or telnet) to a remote machine, you need to
> type (manually) your username and your password. Programming that is
> never easy.

Indeed, so it is much easier to use public-key authentication with an
unencrypted private key, that way you don't have to type any
passwords. See the "AUTHORIZED_KEYS FILE FORMAT" section of the 'sshd'
man page, and the 'ssh-keygen' command.



More information about the Python-list mailing list