Hi everyone, this is a very interesting topic. I just wanted to migrate all the data from one server to another server. However, using I could write my own bash script for that, but I couldn’t find how can I access the other server with the passwordless method. However, just now I could find a solution and here I’m sharing it with my own worlds.
Generate SSH Key on Server 01
Server one is the server you are going to use to access the other one. So, here, you will need to generate a ssh and copy the SSH public key into the other one’s authorized keys. So, when you could do that, servers will be passwordless. For the start, you must have both username and passwords.
To generate the key, first, run the following command.
ssh-keygen -t rsa
If you need strong security, just run the following command instead of the above.
ssh-keygen -t rsa -b 4096
Now you have SSH key on your side. However, now you need to save it on your Server 02. For that, run the following command with other server’s IP. (You don’t want to load second server, you just have to do this command also on the same server.
Now you can use the following command on the same server to login to other server.
So, that’s all you have to do. I will help you if you got any issues. Please let me know. Thanks for being with us.