Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

automatic sftp

Posted on 2006-10-24
5
Medium Priority
?
2,126 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
3 Comments
 
LVL 58

Accepted Solution

by:
amit_g earned 672 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 664 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 664 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
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.

876 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