LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 10-06-2010, 03:57 PM   #1
astroboiii
Member
 
Registered: Feb 2004
Posts: 83

Rep: Reputation: 15
Angry How to use scp or sftp command line with a key file


Running: Red Hat Enterprise Linux Server 5.2 (Tikanga)

I need to be able to automate transferring a few files over from one server to another using scp or the sftp protocol.

I have received a text file which looks like a key file along with username and passphrase information for the target server in question.

Instructions were given to me to import the provided text file in puttyGen then save the imported key as a private key to be used by scp or sftp. My assumption is this is for windows utilities, which I am not using.

My frustration comes in trying to automate logging into this server via sftp or scp to automate some file transfers. I am asked for a password every time because the public and private key methods failed to find my keys.

How can I call scp or the sftp utilities and use the provided key file (the one I generated using puttyGen or the original one provided to me) to login to this server?

I've tried taking the generated ppk file from puttygen and adding it with the ssh-add command but that still did not work.

Any help is greatly appreciated and I will provide any outputs I can as well.

Thanks
 
Old 10-06-2010, 06:37 PM   #2
mbs.tsa
LQ Newbie
 
Registered: Feb 2005
Posts: 2

Rep: Reputation: 4
This is probably a self-evident answer - given that you're trying to use secure utilities to do the transfers - but do you really have to? If you're in a secure environment anyway, it's potentially much easier to create an NFS partition on the server(s) concerned and make it available as a mounted shared device - a straight-forward cp/dd/tar will then suffice...
 
Old 10-06-2010, 10:04 PM   #3
astroboiii
Member
 
Registered: Feb 2004
Posts: 83

Original Poster
Rep: Reputation: 15
Thank you for your reply mbs.

I'm not quite sure what you mean. The SFTP server is hosted off-site and is not physically within the same network.
 
Old 10-07-2010, 11:18 AM   #4
sleddog
Member
 
Registered: Jan 2002
Location: Labrador, Canada
Distribution: CentOS, Debian
Posts: 182

Rep: Reputation: 35
To automate transfer, you need SSH keys setup without any username/passphrase.

And if your transferring between Linux machines disregard all puttygen instructions. That's for putty on Windows.

You say you "received a text file which looks like a key file", which suggests you communicating with someone who administers the remote server?

I'd suggest you communicate with that person, explaining that you want to automate the file transfer and need an SSH key pair setup without any passphrase.

If you have a shell account on the remote server (that gives you write-access to the location where the files are to be stored) then you could set it up yourself, but I think you should first have a chat with whoever is on the other end
 
Old 10-07-2010, 11:27 AM   #5
astroboiii
Member
 
Registered: Feb 2004
Posts: 83

Original Poster
Rep: Reputation: 15
Thanks for your response Sleddog.

I had done exactly as you suggested the other day as that would be the most ideal way to handle it imo.

I am waiting to hear back from them (I am hopeful they will cooperate) but in the meantime was trying to figure out why I wasn't able to get it working even though I have a key file and credentials. Just felt like I was lacking in knowledge here somewhere and that I indeed did have all pieces required to connect.

took another stab today and still couldn't get it going unfortunately. So any help is still appreciated
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
SFTP/SCP with Key Authentication problem on Android Trijicon Linux - Mobile 1 06-27-2010 03:15 PM
SFTP using PPK key file [SOLVED] exactiv Linux - Networking 1 03-26-2010 11:09 AM
Text file editors with built-in SFTP/SSH/SCP ToBe Linux - Software 1 11-19-2008 07:45 AM
SCP command script with password in same line?? your_shadow03 Linux - Newbie 1 11-11-2008 01:10 AM
promptless 'do you accept this server key' with scp/sftp helsing Linux - Newbie 4 03-19-2008 12:24 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration