On Wed, Aug 25, 2010 at 12:58 AM, Brian Fraser <frase...@gmail.com> wrote:

> On Tue, Aug 24, 2010 at 11:08 AM, Peter Scott <pe...@psdt.com> wrote:
>
>
> > CPAN: Net::SSH::Perl .
>
> I had a similar issue not too long ago; Spent a couple of days attempting
> to
> get Net::SSH::Perl to compile properly, gave up, went to CPAN, found
> [Net::SSH::Expect][0]; So far so good, so here's a recommendation.
>
> [0]
> http://search.cpan.org/~bnegrao/Net-SSH-Expect-1.09/lib/Net/SSH/Expect.pod
> <
> http://search.cpan.org/%7Ebnegrao/Net-SSH-Expect-1.09/lib/Net/SSH/Expect.pod
> >
>
i had written a small shell script to make this happen.
cat /root/.logindetails.txt
1:serverinitials:ipaddress:web:userpaswd:rootpassword:0
#!/bin/bash

cat /root/.logindetails.txt |awk -F: {'print $1'} > /tmp/ssh.txt

sleep 2
> ~/.ssh/known_hosts
#data variables

user=$(cat /root/.logindetails.txt |grep -w $1 |awk -F: {'print $4'})
server=$(cat /root/.logindetails.txt |grep -w $1 |awk -F: {'print $3'})
useracc=$(cat /root/.logindetails.txt |grep -w $1 |awk -F: {'print $5'})
suacc=$(cat /root/.logindetails.txt |grep -w $1 |awk -F: {'print $6'})
echo " $user $useracc $suacc"



echo "Connecting to host"
echo " supassword is $suacc"
expect -c "set timeout -1;\
spawn ssh $server -l $user ;\
match_max 100000;\
expect *(yes/no)*;\
send -- yes\r;\
expect *password:*;\
send -- $useracc\r;\
interact;"





-- 
Regards
Agnello D'souza

Reply via email to