python + auto ssh proccess to get date info
Posted
by
david
on Stack Overflow
See other posts from Stack Overflow
or by david
Published on 2011-11-18T09:39:46Z
Indexed on
2011/11/18
9:50 UTC
Read the original article
Hit count: 208
python
I need to perform on my linux 5.3
ssh [Linux machine red hat 5.3] date
in order to get the date results , during ssh need to answer on the following question
- (yes/no)? --> yes
- password: --> diana_123
and then I will get the date results
please advice how to do this automated process with python? ( on my Linux I have Python 2.2.3 )
python script should get the IP address number , and perform automatically ssh to 103.116.140.151 and return the date results
as --> Fri Nov 18 11:25:18 IST 2011
example of manual proccess:
# ssh 103.116.140.151 date
The authenticity of host '103.116.140.151 (103.116.140.151)' can't be established.
RSA key fingerprint is ad:7e:df:9b:53:86:9f:98:17:70:2f:58:c2:5b:e2:e7.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '103.116.140.151' (RSA) to the list of known hosts.
[email protected]'s password:
Fri Nov 18 11:25:18 IST 2011
© Stack Overflow or respective owner