Solved

automatic sftp

Posted on 2006-10-24
5
2,108 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

734 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