Reinstall Ubuntu and Keep SSH keys [duplicate]

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








up vote
0
down vote

favorite













This question already has an answer here:



  • How do I backup ssh keys?

    3 answers



I'm currently running Ubuntu 17.04 on my VPS. I want to go back to 16.04 since 17.04 is at end of life. I have a few remote systems that automatically log into this server using authorized keys. If I start fresh, how can I make sure those machines will still be able to log into the server. I do not have physical access to the remote machines.










share|improve this question













marked as duplicate by David Foerster, user68186, Zanna, Eric Carvalho, Charles Green Feb 6 at 14:02


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.














  • I'd recommend simply backing up your .ssh folders and copying them into the new installation afterwards.
    – Byte Commander
    Feb 5 at 13:45















up vote
0
down vote

favorite













This question already has an answer here:



  • How do I backup ssh keys?

    3 answers



I'm currently running Ubuntu 17.04 on my VPS. I want to go back to 16.04 since 17.04 is at end of life. I have a few remote systems that automatically log into this server using authorized keys. If I start fresh, how can I make sure those machines will still be able to log into the server. I do not have physical access to the remote machines.










share|improve this question













marked as duplicate by David Foerster, user68186, Zanna, Eric Carvalho, Charles Green Feb 6 at 14:02


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.














  • I'd recommend simply backing up your .ssh folders and copying them into the new installation afterwards.
    – Byte Commander
    Feb 5 at 13:45













up vote
0
down vote

favorite









up vote
0
down vote

favorite












This question already has an answer here:



  • How do I backup ssh keys?

    3 answers



I'm currently running Ubuntu 17.04 on my VPS. I want to go back to 16.04 since 17.04 is at end of life. I have a few remote systems that automatically log into this server using authorized keys. If I start fresh, how can I make sure those machines will still be able to log into the server. I do not have physical access to the remote machines.










share|improve this question














This question already has an answer here:



  • How do I backup ssh keys?

    3 answers



I'm currently running Ubuntu 17.04 on my VPS. I want to go back to 16.04 since 17.04 is at end of life. I have a few remote systems that automatically log into this server using authorized keys. If I start fresh, how can I make sure those machines will still be able to log into the server. I do not have physical access to the remote machines.





This question already has an answer here:



  • How do I backup ssh keys?

    3 answers







ssh






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Feb 5 at 13:15









user3735849

31




31




marked as duplicate by David Foerster, user68186, Zanna, Eric Carvalho, Charles Green Feb 6 at 14:02


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.






marked as duplicate by David Foerster, user68186, Zanna, Eric Carvalho, Charles Green Feb 6 at 14:02


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.













  • I'd recommend simply backing up your .ssh folders and copying them into the new installation afterwards.
    – Byte Commander
    Feb 5 at 13:45

















  • I'd recommend simply backing up your .ssh folders and copying them into the new installation afterwards.
    – Byte Commander
    Feb 5 at 13:45
















I'd recommend simply backing up your .ssh folders and copying them into the new installation afterwards.
– Byte Commander
Feb 5 at 13:45





I'd recommend simply backing up your .ssh folders and copying them into the new installation afterwards.
– Byte Commander
Feb 5 at 13:45











1 Answer
1






active

oldest

votes

















up vote
1
down vote



accepted










You need to save your ~/.ssh/authorized_keys file for the user your other servers use to login, and copy that on your new VPS. That way your SSH keys will still be valid, and the other servers will be able to login.



However, with a new install you will also get a new SSH fingerprint, and the hosts will very likely refuse to log into your new VPS.



To remedy that you can either add -o StrictHostKeyChecking=no to your SSH command (or via ~/.ssh/config) on each and every host - which I don't recommend.



Or stop your servers from panicking about the new fingerprint, you can just re-create it:



The server credentials, that make up the "fingerprint" for SSH are actually just keypairs defined in your /etc/ssh/sshd_config:



# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key


Copy these files to your new VPS (with their .pub variants), make sure the paths in sshd_config point to them and the permissions (600 and 644for the .pubs) are correct, reload sshd on your new VPS, and you'll have essentially "cloned" your SSH setup.






share|improve this answer





























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote



    accepted










    You need to save your ~/.ssh/authorized_keys file for the user your other servers use to login, and copy that on your new VPS. That way your SSH keys will still be valid, and the other servers will be able to login.



    However, with a new install you will also get a new SSH fingerprint, and the hosts will very likely refuse to log into your new VPS.



    To remedy that you can either add -o StrictHostKeyChecking=no to your SSH command (or via ~/.ssh/config) on each and every host - which I don't recommend.



    Or stop your servers from panicking about the new fingerprint, you can just re-create it:



    The server credentials, that make up the "fingerprint" for SSH are actually just keypairs defined in your /etc/ssh/sshd_config:



    # HostKeys for protocol version 2
    HostKey /etc/ssh/ssh_host_rsa_key
    HostKey /etc/ssh/ssh_host_dsa_key
    HostKey /etc/ssh/ssh_host_ecdsa_key
    HostKey /etc/ssh/ssh_host_ed25519_key


    Copy these files to your new VPS (with their .pub variants), make sure the paths in sshd_config point to them and the permissions (600 and 644for the .pubs) are correct, reload sshd on your new VPS, and you'll have essentially "cloned" your SSH setup.






    share|improve this answer


























      up vote
      1
      down vote



      accepted










      You need to save your ~/.ssh/authorized_keys file for the user your other servers use to login, and copy that on your new VPS. That way your SSH keys will still be valid, and the other servers will be able to login.



      However, with a new install you will also get a new SSH fingerprint, and the hosts will very likely refuse to log into your new VPS.



      To remedy that you can either add -o StrictHostKeyChecking=no to your SSH command (or via ~/.ssh/config) on each and every host - which I don't recommend.



      Or stop your servers from panicking about the new fingerprint, you can just re-create it:



      The server credentials, that make up the "fingerprint" for SSH are actually just keypairs defined in your /etc/ssh/sshd_config:



      # HostKeys for protocol version 2
      HostKey /etc/ssh/ssh_host_rsa_key
      HostKey /etc/ssh/ssh_host_dsa_key
      HostKey /etc/ssh/ssh_host_ecdsa_key
      HostKey /etc/ssh/ssh_host_ed25519_key


      Copy these files to your new VPS (with their .pub variants), make sure the paths in sshd_config point to them and the permissions (600 and 644for the .pubs) are correct, reload sshd on your new VPS, and you'll have essentially "cloned" your SSH setup.






      share|improve this answer
























        up vote
        1
        down vote



        accepted







        up vote
        1
        down vote



        accepted






        You need to save your ~/.ssh/authorized_keys file for the user your other servers use to login, and copy that on your new VPS. That way your SSH keys will still be valid, and the other servers will be able to login.



        However, with a new install you will also get a new SSH fingerprint, and the hosts will very likely refuse to log into your new VPS.



        To remedy that you can either add -o StrictHostKeyChecking=no to your SSH command (or via ~/.ssh/config) on each and every host - which I don't recommend.



        Or stop your servers from panicking about the new fingerprint, you can just re-create it:



        The server credentials, that make up the "fingerprint" for SSH are actually just keypairs defined in your /etc/ssh/sshd_config:



        # HostKeys for protocol version 2
        HostKey /etc/ssh/ssh_host_rsa_key
        HostKey /etc/ssh/ssh_host_dsa_key
        HostKey /etc/ssh/ssh_host_ecdsa_key
        HostKey /etc/ssh/ssh_host_ed25519_key


        Copy these files to your new VPS (with their .pub variants), make sure the paths in sshd_config point to them and the permissions (600 and 644for the .pubs) are correct, reload sshd on your new VPS, and you'll have essentially "cloned" your SSH setup.






        share|improve this answer














        You need to save your ~/.ssh/authorized_keys file for the user your other servers use to login, and copy that on your new VPS. That way your SSH keys will still be valid, and the other servers will be able to login.



        However, with a new install you will also get a new SSH fingerprint, and the hosts will very likely refuse to log into your new VPS.



        To remedy that you can either add -o StrictHostKeyChecking=no to your SSH command (or via ~/.ssh/config) on each and every host - which I don't recommend.



        Or stop your servers from panicking about the new fingerprint, you can just re-create it:



        The server credentials, that make up the "fingerprint" for SSH are actually just keypairs defined in your /etc/ssh/sshd_config:



        # HostKeys for protocol version 2
        HostKey /etc/ssh/ssh_host_rsa_key
        HostKey /etc/ssh/ssh_host_dsa_key
        HostKey /etc/ssh/ssh_host_ecdsa_key
        HostKey /etc/ssh/ssh_host_ed25519_key


        Copy these files to your new VPS (with their .pub variants), make sure the paths in sshd_config point to them and the permissions (600 and 644for the .pubs) are correct, reload sshd on your new VPS, and you'll have essentially "cloned" your SSH setup.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Feb 6 at 7:25

























        answered Feb 5 at 13:55









        Robert Riedl

        2,740623




        2,740623












            Popular posts from this blog

            pylint3 and pip3 broken

            Missing snmpget and snmpwalk

            How to enroll fingerprints to Ubuntu 17.10 with VFS491