I want to setup SSH keys to automate scp
jobs. My current assumption is that "automate" implies SSH keys without a password, but I am open to your suggestions.
I did a lot of Googling before I asked this question. Here is what I found:
- Lots of pages explain how to configure SSH keys without a password
- Very few pages explaining the security implications of SSH keys without a password
Thus, this question is a prime candidate for what Jeff Atwood calls "Making the Internet a Better Place".
For the purpose of this question, imagine this config:
- Source 1 (not controlled by me):
user1@host1
- Source 2 (not controlled by me):
user2@host2
- Source X/Y/Z (not controlled by me): etc.
- Destination (controlled by me):
user3@host3
- Goal: Setup "jobs" (scripts, whatever) to copy files from
user1@host1
anduser2@host2
(etc.) touser3@host3
usingscp
I already know about:
ssh-keygen
to generate SSH keys- SSH keys can have empty/no password
~/.ssh/id_dsa
has the private key~/.ssh/id_dsa.pub
has the public key- Copy
~/.ssh/id_dsa.pub
into~/.ssh/authorized_keys
and carefully set its file permissions - Share contents of
~/.ssh/id_dsa.pub
with other user/host to use withscp
In my own testing between different hosts/users, I know my setup works.
What troubles me are the security implications. And, I confess that I am not a Linux admin, nor a security expert.
- If I give this public SSH key to another division to use with
scp
, what if that same key is leaked/lost/stolen to another division? - Does this imply anyone with access to this public SSH key can use
scp
againsthost3
asuser3
without a password?
Important assumptions to consider for your responses:
- I do not care about external hackers via the wider Internet. These are Linux boxes on a secure corp network.
- I cannot setup additional user IDs.
I am guessing there is a way to restrict access for a specific SSH key, but I don't know how. Maybe ~/.ssh/authorized_keys
options (which I just learned about today)? Is it possible to have multiple SSH keys -- give a different key to each source?
Please advise The Right Way.