LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 05-11-2021, 12:33 AM   #1
regervin
LQ Newbie
 
Registered: Feb 2018
Posts: 15

Rep: Reputation: Disabled
Why doesn't this rsync command run within a Cron job?


I can run this command without a problem from the command line:

Quote:
rsync -rtpogvlbs --progress --delete --ignore-existing --delete --delete-before --delete-excluded --exclude-from=/home/xxxxx/.ignorelist --force /home/xxxxx/ xxxxx@192.168.0.250:/volume1/Backups/Xxxxxx
However when try to run it from a corn job, I get this error:

Quote:
rsync: [client] failed to open exclude file /home/xxxxx/.ignorelist: Permission denied (13)
rsync error: error in file IO (code 11) at exclude.c(1188) [client=3.2.3]
I have checked the folder and file permissions but can't seem to find the problem.

Any help will be appreciated‼

Last edited by regervin; 05-11-2021 at 06:57 AM.
 
Old 05-11-2021, 02:18 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,850

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
I can only guess: you use a different account for crontab (for example root?), which has no .ignorelist in the home dir (or has no right to access that file).
 
Old 05-11-2021, 03:48 AM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,702

Rep: Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896
The error shows a hidden file but command run from the CLI does not.
Are you using a running script or the command is a single cron job?
 
1 members found this post helpful.
Old 05-11-2021, 07:04 AM   #4
regervin
LQ Newbie
 
Registered: Feb 2018
Posts: 15

Original Poster
Rep: Reputation: Disabled
@michaelk - thanks for pointing that out (it was actually a typo) but after correcting it, the problem is still the same.
 
Old 05-11-2021, 07:17 AM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,702

Rep: Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896
You did not answer pan64's question. Which user is running the cron job?

Is it your xxxxx or something else?
 
Old 05-11-2021, 07:22 AM   #6
regervin
LQ Newbie
 
Registered: Feb 2018
Posts: 15

Original Poster
Rep: Reputation: Disabled
I tried it as myself and as root.
 
Old 05-11-2021, 08:37 PM   #7
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,324
Blog Entries: 28

Rep: Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142Reputation: 6142
I'm not sure it's relevant, but what are the permissions on the file, "ignorelist"?
 
Old 05-11-2021, 08:57 PM   #8
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,727

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
Quote:
Originally Posted by frankbell View Post
I'm not sure it's relevant, but what are the permissions on the file, "ignorelist"?
Yup. That’d be the first thing to look at when getting a “permission denied” error
Also wondering why it is hidden?
 
1 members found this post helpful.
Old 05-12-2021, 02:46 PM   #9
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,982

Rep: Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626
Cron usually has to be treated like a user. All permissions you have to run it from command line also need to be allowed in cron either by user or group.
 
Old 05-14-2021, 11:39 AM   #10
regervin
LQ Newbie
 
Registered: Feb 2018
Posts: 15

Original Poster
Rep: Reputation: Disabled
The current file permissions are 644, although for the sake of testing, I changed them to 777 with the same effect.

It's hidden so that I don't accidentally delete it or move it at some point in the future.
 
Old 05-14-2021, 01:00 PM   #11
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,850

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
this is not about the permission on the file, 644 should be enough. Probably it is a permission issue on the dir or it is a completely different file (or user).
Or something which is still unknown for us.
 
Old 05-14-2021, 08:08 PM   #12
regervin
LQ Newbie
 
Registered: Feb 2018
Posts: 15

Original Poster
Rep: Reputation: Disabled
The directory permissions are 744; I changed it to 777 for testing and got the same message.
 
Old 05-15-2021, 12:55 PM   #13
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,850

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
ok, so it is your job now to find out what is wrong.
Quote:
rsync: [client] failed to open exclude file /home/xxxxx/.ignorelist: Permission denied (13)
is quite clear, the user who started to execute that rsync command is not allowed to read that file (or dir).
Either you specified a different file/path, or used a different user or something was just mistyped.
What you posted is not really enough to point out that mistake and what you tried (and posted) was not effective, so you need to check carefully these settings again.
 
Old 05-15-2021, 04:08 PM   #14
regervin
LQ Newbie
 
Registered: Feb 2018
Posts: 15

Original Poster
Rep: Reputation: Disabled
That's just it...I have verified the ownership of both the directory and the file:

Directory: drwxr-x--x. 75 xxxxx xxxxx 4096 May 13 15:01 xxxxx

File: -rw-r--r--. 1 xxxxx xxxxx 7646 May 9 18:57 /home/xxxxx/.ignorelist

I have also verified that the same user (which is me) runs the cron job...

At this point, I've run out of ideas.
 
Old 05-16-2021, 04:49 AM   #15
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,850

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
-rw-r--r--. the dot means at the end: SELinux is enabled.
Also checking these permissions is not enough, you need to check that too: https://tekneed.com/understand-what-...-troubleshoot/
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How can I run a Cron job manually or how can I sure my job executed? n00b_noob Linux - Newbie 43 02-24-2021 10:38 PM
Debian daily cron job won't run, but does run in cron.hourly. sandersch Linux - General 7 05-24-2012 01:50 AM
[SOLVED] cron job - run a backup then rsync results to mounted drive lukester Linux - Newbie 8 03-28-2012 06:53 PM
how can i run rsync as a cron job using public keys authentication disorderly Linux - Server 14 03-13-2008 09:51 PM
adding a perl script to cron.daily / cron.d to setup a cron job CrontabNewBIE Linux - Software 6 01-14-2008 08:16 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 11:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration