I am running a test script where files needs to be copied to the target embedded system.But when this command of copying the files to remote target system is run from the sc
Use the -i option. Manpage says:
-i identity_file
Selects the file from which the identity (private key) for public key authentication is read. This option is directly passed to ssh(1).
That is do :
scp -i /path/to/identity_file test.file1 :/home/bot21/test/
The process of creating the identity file is well described [ here ].
The access-permissions for the identity file should be configured in such a way that potential users in your system who may access this file should be able to read it. Also mind that these users should be able to traverse the path ie /path/to in our example to reach the file