0

This question already has an answer here:

Is it safe if my server will create a SSH key pair for my client? Scenario: I(server admin) will create a ssh key pair and put public key into authorized_keys and give the private key to client so he can access my sftp server.

marked as duplicate by Kusalananda, ilkkachu, user34720, Anthony Geoghegan, Jeff Schaller Mar 22 at 17:25

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Hi @Archemar thank you for responding. but is it safe on the server part? to give out private keys which my server created? – Allan Parcutela Mar 22 at 5:53
  • 2
    Your customer should be generating their own keys and securing them with a passphrase, then giving you their public key to store on the server you manage that they need to access. Their private key should never be given to anyone and it should be encrypted (i.e. secured with a passphrase). – kingmilo Mar 22 at 6:46
  • 2
    Never generate a private key for someone else. Never accept a private key generated for you. – Kusalananda Mar 22 at 7:01
  • @Kusalananda agreed in theory, but the sad reality is that a lot of end users don't necessarily have the know-how to generate an SSH keypair and will complain if you give them the instructions. – Shadur Mar 22 at 9:42
  • I think this is will apply to all Unixs, not just UNIX. – ctrl-alt-delor Mar 22 at 9:50
0

Quick $0.02 because I've got to get ready for work:

Assuming this server isn't protecting actual banks or national security-level secrecy, you're fine.

About the only potential risk I can imagine from this is if a hostile third party intercepted enough of those private keys and the exact time they were generated, they could use that to make predictions about the state and algorhithm of the server's random number generator, which might be useful in some very sophisticated attacks.

... Of course, if they can intercept that many of your private keys you have much bigger problems already.

The safest thing to do would be to let the client generate the keypair and use a trusted channel to send you the public key for inclusion into the authorized_keys file, but if that isn't an option for whatever reason, your main worry is going to be how to securely get the private key to the recipient and only the intended recipient.

  • +1 for letting the client generate the key pair, but a trusted channel for sending the public key is really not needed. The public key is, as the name says, public. – Johan Myréen Mar 22 at 7:40
  • 2
    The 'trusted' part of the channel is because you want to make sure it's the client's public key you're receiving and not someone's MITM key. – Shadur Mar 22 at 7:49
  • Whoever downvoted this, might I ask why? I appreciate constructive criticism. – Shadur Mar 22 at 9:25
  • 1
    @Shadur You do need a trusted channel to send public keys: The channel does not have to keep the key secret, but the receiver does have to be able to trust that it came from who it claims to come from. – ctrl-alt-delor Mar 22 at 9:49
  • That's what I said, yes. @JohanMyréen was arguing otherwise. – Shadur Mar 22 at 9:50
0

Your customer should be generating their own keys and securing them with a passphrase, then giving you their public key to store on the server you manage and that they need to access. Their private key should never be given to anyone and it should be encrypted (i.e. secured with a passphrase).

-2

To allow access vith ssh/scp/sftp you can use public/private key pair. (*)

I you generate and install such pair you will controll who will access a specific part of your server (in your case sftp directory).

If you have two or more customer/partner, be sure to generate one key per partner.

This way customer1 will access customer1's part. If set correctly (**), private customer1's key will not access customer2's files, nor any other part of the server.

  • (*) assuming as noted by Shadur, that transfert is safe from prying eyes.
  • (**) using chroot if possible (this depend on your directory structure).

As noted in my (deleted) comment, this is also a matter of trust from customer's part, but that should be OK, customer already trust you with his file.

Not the answer you're looking for? Browse other questions tagged or ask your own question.