LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Rsync permission denied using cron server to server over internet (https://www.linuxquestions.org/questions/linux-newbie-8/rsync-permission-denied-using-cron-server-to-server-over-internet-4175605921/)

chripy811 05-14-2017 11:04 AM

Rsync permission denied using cron server to server over internet
 
I am able to get rsync working, from directory to directory on local computer,
and its even working from server to server if i input the command manually(it asks me for my password)


But using a cron over the internet from server to server, i am getting a permission denied from the cron, in the mail


I noticed when i make a cron and it runs at it's scheduled time, it doesn't ask me for a password and even if it did, i wouldn't be around when the cron runs.

is there a way i can put -pmypassword somewhere in my cron?


This is the command i am using in the cron:



rsync -av --delete -e ssh /mywebsitefiles/ root@89.123.123.123:/backup_of_mywebsitefiles/


where exactly do i put the password inside that cron commanad



thanks!

pan64 05-14-2017 11:24 AM

at first you gave no exact information, so we can only guess. Probably you only mistyped something, or ????
But putting a password (of root) into crontab is not a good idea at all. You ought to configure passwordless login, use different account.
Probably the password contains something strange which may cause a syntax error.
I would try to write a shell script which can be invoked from a terminal and also works from crontab too.
Cron has no terminal and is not able to ask for any password.

Turbocapitalist 05-14-2017 12:41 PM

Quote:

Originally Posted by chripy811 (Post 5710572)
where exactly do i put the password inside that cron commanad

You don't. You would invoke the SSH client with an option pointing it to the right key to use for authentication instead of a password.

Code:

rsync -av --delete -e 'ssh -i /home/chripy/.ssh/some_key_rsa' chripy@203.0.113.123:/backup_of_mywebsitefiles/
Again, you should turn off remote root access as soon as possible.


All times are GMT -5. The time now is 02:01 AM.