Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to automate the scp command?

 
Srikanth Kumar
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here i have a problem in copying a file from one unix machine to another using scp command.

when i tried to execute the following command
[code]
scp /usr/tmp/abc.txt <some other ip>:/usr/tmp/
[code]

i got the prompting message below.
[code]
The authenticity of host '<some other ip>' can't be established.
RSA key fingerprint is 1d:9d e e:5b:bb:ab:8e:ae:8c:87:fe:66:3f:c5:6b.
Are you sure you want to continue connecting (yes/no)?
[code]

I want to automate this process. is there any option or parameter do we need to pass along with this command? Or can we achieve this using shell script?

ZThanx in advance.
 
Charles Lyons
Author
Ranch Hand
Posts: 836
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about:
[ November 04, 2008: Message edited by: Charles Lyons ]
 
Srikanth Kumar
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. it also does not work.
It still prompting yes/no option.

Any other parameters can achieve this?

help on this is appreciated.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18094
48
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To get rid of the prompt, type "yes" and the host will be added to the ssh known_hosts file. You won't be asked again unless the security signature of either the client or server changes.

To avoid even being asked the question - and the password prompt, add a security certificate to the client's ssh configuration.

For details, check out the full documentation of the SSH (openssh) command
[ November 05, 2008: Message edited by: Tim Holloway ]
 
Philip Thamaravelil
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
IMO you'll have to setup ssh keys between the machines..
this will allow you to ssh and scp from one machine to another without a password prompt/security prompt.

have a look here for some guidance..
http://pkeck.myweb.uga.edu/ssh/


I've written some scripts to do this automatically..if your interested in having them email me. philip@consultant-solutions.com

cheers

Philip
 
Pat Farrell
Rancher
Posts: 4678
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Philip Thamaravelil:
IMO you'll have to setup ssh keys between the machines..
this will allow you to ssh and scp from one machine to another without a password prompt/security prompt.


Actually, that's not the OP's problem. He just needs to connect once and accept the server's RSA key.

Doing the full setup is handy, but really is a secondary consideration.
 
Philip Thamaravelil
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The title of this thread is 'How to automate the scp command?'

You must setup keys in order to automate a scp file transfer.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15214
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Philip T, please check your private messages for an administrative matter. You can see them by clicking My Private Messages.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic