I have a python script. In that, I am using rsync
for data transfer between two systems. While running, it ask for password for data transfer. So that I create a password-less run by the below command.
ssh-keygen -t dsa
ssh-copy-id -i $HOME/.ssh/id_dsa.pub [email protected]
Now it works fine. While running my python script, the data can be transferred without asking for password. But the problem is that I create a crontab job, and run my script at every reboot, which means every time the system is on, the code will be executed automatically.
In this situation, while reboot, my script starts to execute. But it asked destination system password for data transfer (open one small dialog-box in the name of openssh
).
What to do while reboot the system is not suppose to ask password.
Note: if I am supposed to run my script manually, it could not ask password. The data can be transferred to destination system perfectly.
If you know please teach me .I am waiting.
What I think is that your ssh key has been generated for your regular user account (stored in
/home/user/.ssh/id_dsa
).However, the reboot cron is probably run by the root user looking for ssh key as
/root/.ssh/id_dsa
Possible solutions:
crontab -e
, so that rsync/ssh will be run by your user and use the ssh key of your user.rsync -e "ssh -i /home/user/.ssh/id_dsa"
in the root crontab so that root will use your user ssh key