Issue
- I have a key on machine B that with it can log to machine A
- on machine A I can run a script to create archive dump from database
- Now I wish to get this archive from A back to B
PROBLEM! I want to ONLY HAVE ONE KEY file on machine B to connect to machine A and avoid having another key on machine A to connect back to machine B
Im trying to do this with scp command,
scp -i key_file `date +"%m-%d-%y".gz` [email protected]:`date +"%m-%d-%y".gz`
Problem here is that while I am logged into machine B, and I run this I need to have another key_file on machine A.
Could I achieve this somehow by only having one key on machine B, use that to operate in machine A and get the file out without having another key?
I want to limit security threats and not have two keys so that if machine A gets jacked it wont have access to B.
Solution
If you can ssh
into computer A from computer B, then you can do an scp
command from computer B to retrieve the file from computer A back to computer B, as well. Run this command from computer B:
scp -i your_key [email protected]:/path_to_file_in_comp_A/file /path_in_comp_B/
where you need to substitute the correct key file, usernames, ip addresses, and paths to the command.
Answered By - wxz