Reputation: 95
I need to execute a command through perl script, if it asks for password to execute i need to ignore otherwise i can proceed further.
my $cmd = `ssh root\@192.168.1.1 '/bin/cat /root/a.txt'`;
Upvotes: 0
Views: 81
Reputation: 20232
Besides using something like Net::SSH::Perl
like I suggested above. You can enable batchmode
my $cmd = `ssh -oBatchMode=yes root\@192.168.1.1 '/bin/cat /root/a.txt'`;
if batchmode is set to yes, it will disable the querying of password/passphrase, which makes it pretty useful in scripts
Upvotes: 4