Solved

automatic sftp

Posted on 2006-10-24
5
2,111 Views
Last Modified: 2013-12-26
I want to try automatic sftp of files using a script that runs on cron.

I've used automatic ftp in which you supply username & password too. But sftp seems to be different. Can anyone help me about how to achieve this?

Thanks,
m_razesh.
0
Comment
Question by:m_razesh
[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
5 Comments
 
LVL 58

Accepted Solution

by:
amit_g earned 168 total points
ID: 17798448
Make sure that you have setup SSH for passwordless authentication and then it is trivial to use sftp. You might need you system admin's help in getting passwordless authentication to work.

http://acd.ucar.edu/~fredrick/mpark/ssh/rsa-unix.html
http://www.snailbook.com/faq/scripting-sftp.auto.html
0
 
LVL 24

Assisted Solution

by:fridom
fridom earned 166 total points
ID: 17817309
Another option is using ssh-agent, on the client machine and keep the key in it. As long as ssh-agent is running and the key have been added it is like passwordless usage.

Regards
Friedrich
0
 
LVL 1

Assisted Solution

by:jonesstu
jonesstu earned 166 total points
ID: 17818910
sftp uses the ssh protocol for authentication and encryption. You can still use username and password, but that usually means storing the password in plain text on the client end when you are automating it. ssh supports using public/private key authentication so that the user doesn't have to supply a password.

To set up ssh so that it doesn't use passwords:
1. On the client type: ssh-keygen -t rsa
  Accept the defaults, and don't enter a passphrase for the key.
2. Copy the line in ~/.ssh/id_rsa.pub (the public key) to the ~/.ssh/authorized_keys file on the server.
3. Make sure all .ssh/* on both ends are not world readable, writeable or browseable. ( chmod og-rwx .ssh/* )
4. Try it out from the client with:
   ssh <yourserver> ls -l
   It should moan the first time that it doesn't recognise the server. Accept the server's fingerprint. Subsequently it should be ok.
5. sftp should now authenticate automatically too.

0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

617 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