Re: Expect script to install sshkey
- From: ramprasad@xxxxxxxxxxxxxx (Ramprasad A Padmanabhan)
- Date: Fri, 03 Mar 2006 10:58:08 +0530
Wiggins d'Anconia wrote:
Ramprasad A Padmanabhan wrote:
Hi all,
I have a perl Expect script that install rsa keys for ssh auto login.
When I run the script on command line it works fine.
Now when I run it inside a CGI the script simply gets stuck. I can see
from the from the SSH server and also the expect logs that the login is
happenning. But After login nothing happens :-(
The commands I give to append the authorized_keys2 file are not executed
at all.
Are the keys readable by the web server user? Sounds like a permissions
problem.
The problem is not with permissions. Actually this is the part script where it hangs
.......
# $exp is the expect object
$exp->expect(10,
'-re' , $prompt , \&inter,
'-re',"password:",sub {}) or die "Couldnt get pass prompt\n";
$exp->send("$password\r");
$exp->expect(10, -re , $prompt) or die "Couldnot login\n";
# Until here it is fine. I can see in the ssh logs that login has happened
# The foll commands work if run on commandline only
$exp->raw_pty(1);
$exp->send("\r");
my $cmd = "lynx -source http://192.168.2.32/rsakey.txt >> ~/.ssh/authorized_keys2\r";
$exp->send($cmd);
$exp->send("\r");
$exp->send("sleep 1 && exit\r");
# The next step is compulsory else nothing works even on command line
# I dont understand why
$exp->interact();
exit(0);
###############################
I can attach my entire script if necessary
Thanks
Ram
.
- Follow-Ups:
- Re: Expect script to install sshkey
- From: Peri
- Re: Expect script to install sshkey
- References:
- Expect script to install sshkey
- From: Ramprasad A Padmanabhan
- Re: Expect script to install sshkey
- From: Wiggins d'Anconia
- Expect script to install sshkey
- Prev by Date: Re: Very basic question about arrays ...
- Next by Date: Re: File::Find module won't run recursively?
- Previous by thread: Re: Expect script to install sshkey
- Next by thread: Re: Expect script to install sshkey
- Index(es):
Relevant Pages
|