Solved

Using sftp in perl without using NET::SFTP

Posted on 2008-06-18
6
1,361 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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

707 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

17 Experts available now in Live!

Get 1:1 Help Now