Forum Discussion

drolano's avatar
drolano
Icon for Altocumulus rankAltocumulus
Feb 21, 2024

How can I automate backup using SFTP on cluster nodes?

Hi!

 

I´m trying to automate backup to a remote host using SFTP. 

I´ve generated keys uysing ssh-keygen and it works from one node.

Now, I want to do the same from the second host of the HA cluster.

I don´t know if I can just copy both private and public key to the second node or if I have to generate keys on the second node again. Could somebody help me please?

 

Also, I've tried to rename the keys from id_rsa to a more significant name but then the sftp doesn´t work. Why is it? Does it reference the original name somewhere?

How should I generate the keys with a significant name to the same folder /root/.ssh? Would it be better to use the default name id_rsa?

 

Thank you very much.

  • I have understood how it works. I thought that I had to put the private key file name in the textbox "Copy/Paste the SSH private key to be used for passwordless authentication:"

    But, I have to put the content of the private key. So there´s no need to copy private keys between nodes.

    Now, it works fine!.

    Thanks.

  • you just need to add the same public key generated by ssh-keygen, not the private key, to user's ~/.ssh/authorized_keys file in second and subsequent SSH servers.

    • drolano's avatar
      drolano
      Icon for Altocumulus rankAltocumulus

      But, your solution would be to sftp from f5-node1 to f5-node2, wouldn´t it? 

      I f I want to sftp from f5-node1 to SFTP server and f5-node2 to SFTP server I think that your solution isn`t valid. Am I wrong?

  • I have understood how it works. I thought that I had to put the private key file name in the textbox "Copy/Paste the SSH private key to be used for passwordless authentication:"

    But, I have to put the content of the private key. So there´s no need to copy private keys between nodes.

    Now, it works fine!.

    Thanks.