Sometimes, we want to authenticate ourselves over SSH, but do not prefer to use passwords for authentication. Executing test scripts on a remote machine in an automated way is just one such example. In this article, we will discuss how to configure SSH key-based authentication on a Linux server with an example of executing test scripts on a remote Linux machine.
What are the disadvantages of password-based authentication in SSH?
Here, I have a remote machine in my local network with IP address REMOTE_IP. I would want to execute some local scripts in that machine and analyze the results. In this article, I will show what the disadvantages of password-based authentication in this scenario are, and then we will configure SSH key-based authentication.
Installing SSH
Let’s first install SSH on both machines.
# sudo apt-get install ssh
Now, I can log in to the remote machine from the local host.
# ssh <user and REMOTE_IP> Password:
I am able to log in, so the first step is done.
Copying test scripts in the remote machine
Now, I would open another terminal and copy the local script to the remote machine.
# scp -p sample.sh <user and REMOTE_IP>:/home/user/testsuites Password:
Once I give the correct password, the script will be copied in the remote host.
0 Comments