Solved

Using sftp in perl without using NET::SFTP

Posted on 2008-06-18
6
1,366 Views
Last Modified: 2011-09-20
Hello,

Can anyone please help explain how to use sftp in perl without using NET::SFTP. I think it will be possible just by using binary commands in program. For eg. using
sft username\@hostname.
If I want to use this from program where should I put password? If anyone put some sample lines that would be a great help. Urgent replies would be highly appreciated.

Thank you as always!
0
Comment
Question by:Andys1
6 Comments
 
LVL 13

Assisted Solution

by:MicheleMarcon
MicheleMarcon earned 100 total points
ID: 21819554
0
 

Author Comment

by:Andys1
ID: 21819741
Hello I can not check this link from my office as it is filtered. It would be a great help if you could paste the contents or otherwise I will check it at home. THank you
0
 
LVL 48

Accepted Solution

by:
Tintin earned 200 total points
ID: 21819931
That link doesn't really contain the information you are after.

Firstly, why don't you want to use Net::SFTP?

Here's an example of feeding responses to sftp
open SFTP, "/usr/bin/sftp user@host|" or die "Can not run sftp $!\n";

print SFTP "some command\n";

print SFTP "some other command\n";

print SFTP "exit\n";

close SFTP;

Open in new window

0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 

Author Comment

by:Andys1
ID: 21819984
Thanks Tintin, Acutally I am using perl5.0024 and I copied NET::SFTP and refered the directory using use lib (path) but it threw some exceptions. In my company if I want to install any package then I have to go through various steps and very time consuming so I decided to use SFTP.

Just wondering where to specify the password in above code? I want to schedule this program from cron jobs.
0
 
LVL 16

Assisted Solution

by:xDamox
xDamox earned 200 total points
ID: 21820722
Hello,

I would recommend you use public key authentication with SFTP this will make your program
much simpler to write.

0
 
LVL 48

Expert Comment

by:Tintin
ID: 21820989
Diito regarding ssh keys.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now