The solution to overcome this problem is
Goto slave node switch to the root user
sudo su
Add a user to jenkins home using
useradd -d /var/lib/jenkins jenkins
Here /var/lib/jenkins is having my home directory
Now, from jenkins master copy the id inside id_rsa.pub from jenkins user
cat /var/lib/jenkins/.ssh/id_rsa.pub
Now, create an authorized_keys file for jenkins user form slave node
mkdir /var/lib/jenkins/.ssh
And create an authorized_keys file
vi /var/lib/jenkins/.ssh/authorized_keys
Paste the id that you have copied from id_rsa.pub here and save the file with “:wq!”.
This will help you to resolve the issue.
For more information please go through the following tutorial to get more info about jenkins: