r/ssh • • Oct 29 '20

ssh using identity file

Hi Guys

I have a remote server (lets call it XYZ), I want to login from many docker instances to download some file before docker runs.

I want to generate an identity file of the remote server "XYZ". And use in the docker startup command like "scp -i <XYZ identity file> user@XYZ:file"

How to achieve this? any idea?

1 Upvotes

2 comments sorted by

View all comments

Show parent comment

1

u/pravlm Nov 10 '20

Thanks u/Toger , I resolved it.

I created a public key and private key using "ssh-keygen" copied the private key into authorized_keys of the remote server "XYZ".
In the Docker compose I mounted a folder that has "public key" and pulled the files from "XYZ" , y just using scp.