Solved

automatic sftp

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

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

Suggested Solutions

Title # Comments Views Activity
Host to IP 7 73
Detect CR LF to each line 12 137
scoreUp challenge 14 48
Trying to run powershell  in a batch file. How do I do this? 8 47
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 …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

747 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

9 Experts available now in Live!

Get 1:1 Help Now