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 root@

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:

  • Put your cron in the user crontab with crontab -e, so that rsync/ssh will be run by your user and use the ssh key of your user.
  • Generate a ssh key for the root user, and add the key to the remote server
  • Use rsync -e "ssh -i /home/user/.ssh/id_dsa" in the root crontab so that root will use your user ssh key
  • Check carefully that your ssh keys were not generated with a passphrase protection. If that's the case you will need to type manually the passphrase to unlock the ssh key.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.