1

I need to scp some .xml files (of duration April-May 2016) from a Solaris server (Server A) to a Linux server (Server B) where the Solaris server is the home directory where the script is written and will be executed.

I have written the below script for this-

#!/bin/sh

ssh [email protected] touch --date "2016-04-01" /tmp/start.tmp
ssh [email protected] touch --date "2016-05-31" /tmp/end.tmp

for i in `find /home/hs/demo*.xml -type f -newer /tmp/start.tmp -not -newer /tmp/end.tmp`
do
scp [email protected]:$i [email protected]:/data/Output
done

But after executing the script from server A it is prompting me for password (which I don't want to happen, as I need the Solaris to automatically scp files without human intervention)

And for doing scp I have created keys using command "ssh-keygen -t rsa" in Solaris server (Server A- 10.20.14.49) and have copied the public key to the Linux server (Server B- 10.24.21.11).

But still after executing the script from server A it is prompting me for password, and so I have created a config file in Server A under /home/hs/.ssh, and below are its contents:-

Host oa
User dev
HostName 10.24.21.11
IdentityFile ~/.ssh/my_ssh_key

But still Solaris (Server A) is prompting me for password.

3
  • On target server add your public ssh key in ~/.ssh/autorized_keys Commented Sep 28, 2016 at 12:52
  • 1
    There may be a problem with permissions on the .ssh directory, or its files - Solaris can be more strict that Linux by default on this. Could you check/provide verbose scp output to see if key is being considered / rejected?
    – ocurran
    Commented Sep 28, 2016 at 13:49
  • Is your user account on 10.20.14.49 really called server? And your user account on 10.24.21.11 called dev?
    – MikeA
    Commented Sep 28, 2016 at 16:11

1 Answer 1

1

you may want to use this command instead, if it is available:

ssh-copy-id [email protected]

This will transfer your public key to the remote server and handle the authorized key process for you.

1
  • This command worked perfectly for me, but the key that was inserted on the target server looks nothing like either the public or private key generated by ssh-keygen. So what is this key that is copied? (Admittedly I was working from Linux to Solaris 8, but I expect the rules should be the same.)
    – Sinc
    Commented Oct 30, 2018 at 20:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .