scp'ing using key file as a parameter, How can I do that if possible?
Solution 1:
-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).
Use ~/.ssh/id_rsa
.
Solution 2:
This might help another noob.
[I know this is a redundant circular example but its good to illustrate] Scenario:
- ssh from Mac -> Ubuntu
- scp files from Mac -> Ubuntu
- close ssh and scp files from Ubuntu -> Mac
I had only created ssh keys on my Mac (via ssh-keygen) and shared them with the machine running Ubuntu via (ssh-copy-id). So I could copy files, while logged into my Mac from the machine running Ubuntu, but not the other way around.
Solution: I had to create ssh keys on the Ubuntu Machine and share them with my Mac. then I could successfully run the following command on the Ubuntu Machine
Mac IP: 192.168.1.40
Ubuntu IP: 192.168.1.38
On Mac
ssh-keygen
ssh-copy-id [email protected]
ssh [email protected]
# Now on Ubuntu
ssh-keygen
ssh-copy-id [email protected]
And now the following command should copy the file without asking for password to MAC
sudo scp -i /home/ubuntu/.ssh/id_rsa [email protected]:~/Documents/Fluff/Version-Control/tools/pull.sh .