#!/usr/bin/perl use strict; use warnings; use Net::OpenSSH; print "Enter user name: "; my $user = ; chomp $user; print "Enter password: "; my $password = ; chomp $password; print "Enter domain :"; my $domain = ; chomp $domain; my @hosts = `host -l $domain |cut -d " " -f 1`; foreach my $host (@hosts) { chomp $host; print "Accessing $host... \n"; my $ssh = Net::OpenSSH->new($host, user => $user, password => $password, strict_mode => 0, timeout => 1, master_opts => [-o => "StrictHostKeyChecking=no"]); $ssh->error and warn "ssh failed on $host : " . $ssh->error; my $test = $ssh->system('sudo crontab -u foouser -l'); }