Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to parse password during the find command in linux?

I need to parse password during find a file in remote linux system, how can I read a remote directory in linux?

I tried one:

ssh [email protected] "find /var/www/home" sshpass -p pass

it didn't work properly in linux, if any one face this solution, please let me know...

I tried two:

 opendir(IN, "[email protected]:/var/www/home") || die "can't open !";

I tring also perl but it didn't work properly,

How can I start? How can I read a remote directory?

like image 394
AlexPandiyan Avatar asked Nov 12 '22 18:11

AlexPandiyan


1 Answers

use Net::SFTP::Foreign.

use Net::SFTP::Foreign;
my $sftp = Net::SFTP::Foreign->new($host, user => $user, password => $password, autodie => 1);
my $ls = $sftp->ls($dir);

use Data::Dumper;
print Dumper($ls);
like image 112
salva Avatar answered Nov 14 '22 08:11

salva