经过大量研究,我找不到解决方案,但发布了这个问题。SCP不在crontab中工作,但在命令行上工作
我有一台电脑A和B都是Ubuntu桌面。我想将文件从A复制到B.我遵循的步骤。
1. ssh-keygen in computer A
2. Left password blank
3. Copied id_rsa.pub to computer B ~/.ssh/ from computer A
4. Renamed id_rsa.pub to authorized_keys in computer B
5. In computer A I did scp -i ~/.ssh/id_rsa -r /var/www/abc [email protected]:/home/abc/
如果我在命令行中执行第4步,它的工作正常。但是当我在crontab中做同样的事情时
22 10 * * * root scp -i ~/.ssh/id_rsa -r /var/www/abc [email protected]:/home/abc
它什么都不做。
到这里看看:https://askubuntu.com/questions/23009/reasons-why-crontab-does-not-work – ceving