Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Using sftp in perl without using NET::SFTP

Posted on 2008-06-18
6
Medium Priority
?
1,380 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 13

Assisted Solution

by:MicheleMarcon
MicheleMarcon earned 300 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 600 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
Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

 

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 600 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

Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

Question has a verified solution.

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

FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses

722 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