i'm in NAS/permissions hell!

RichMiller

New Member
Joined
Nov 12, 2020
Messages
26
Reaction score
8
Credits
254
Hello,

As context, about a year ago I (along with 70% of the population) decided to move my work computer back home, in the shed more specifically. For security reasons i've decided to keep all the HDDs and the NAS drive back indoors, connected via a decent CAT6 ethernet cable I ran to the shed. (sorry, I add more fluff than a bad D&D DM)

Also as context, I am really quite ignorant when it comes to Linux - I am trying where I can to understand, I have come on quite far in my journey but i'm still incredibly uneducated. I'm proud to say that the following issues i did have running for a few months, however it's kind of come to a grinding halt.

I have a couple of scripts I run from crontab at 1am and 3am, they're both rsync scripts.
One script backs up a folder from a USB drive (A) to the backup drive (B) and looks like this;

#!/bin/bash

sudo rsync -arvh --progress "/mnt/sdc1/RESOURCE LIBRARY/" "/mnt/sde1/RESOURCE LIBRARY"


The second script backs up a folder from the NAS drive (N) to the backup drive (B)

#!/bin/bash

sudo rsync -arvh --progress "/mnt/Jupiter/Caravan/001 Caravan Projects/" "/mnt/sde1/PROJECTS_300"



The first script still runs well, with no issues.
The second NAS backup script however, gives me the following error, which I have emailed to me via the MAILTO in crontab.

"rsync: change_dir "/mnt/Jupiter/Caravan/001 Caravan Projects" failed: Permission denied (13)"

I am (now this is where you are no doubt going to do some head slapping/shaking) sure this is because i've sodded around too much with chowning/chmodding different folders, so much so I just can't work out who owns what now. And i'm assuming the issue is to do with folder ownerships, at least i'm hoping.

Is there a way to .. safely reset ownerships over everything? Or at least check who owns that /mnt/Jupiter .. folder?

This is such an irritating problem to help with, it's the equivalent of someone bringing a home-made Frankensteined junk car into a mechanics and asking for a once-over .. However, i'm kind of at a loss. I just keep running into that 'permission denied 13' issue, and google serves up other peoples problems that I can't quite figure out myself to tell if they're at all relatable.

You guys have helped me out in the past, and I really appreciated your help then, I will once again!
Cheers,
Rich
 


G'day Rich Miller, Welcome to Linux.org

This is way out of my field, but there are others here who can help.

By mentioning their user names below, it will let them know there is a topic here they may be able to help with.

Be patient.

@f33dm3bits
@JasKinasis
 
Why are you using sudo with rsync? If the permissions are setup correctly that shouldn't be needed or you can configure it the cronjob to run under root. As what user is this script running and can you share the output of the following.
Code:
ls -l /mnt
ls -l /mnt/Jupiter
ls -l /mnt/Jupiter/Caravan
ls -l "/mnt/Jupiter/Caravan/001 Caravan Projects"
FYI it's not really smart to be using spaces in file or directory names when running on Linux.
 
Why are you using sudo with rsync? If the permissions are setup correctly that shouldn't be needed or you can configure it the cronjob to run under root. As what user is this script running and can you share the output of the following.
Code:
ls -l /mnt
ls -l /mnt/Jupiter
ls -l /mnt/Jupiter/Caravan
ls -l "/mnt/Jupiter/Caravan/001 Caravan Projects"
FYI it's not really smart to be using spaces in file or directory names when running on Linux.

Thanks for responding!
My use of sudo is my equivalent of a 'hope for the best' tactic. It's not that I don't understand what sudo does. I'm aware it's almost like using an overseer login to execute something, it's just I lack confidence in knowing the user persmissions/ownerships of this whole ramshackle set-up that I started to use sudo before everything ... and hope for the best!

Here's the results of the ls commands (copy pasting this makes it look like a headache, so i've screenshotted it);

ls -l /mnt
1613073162175.png


I had to sudo /mnt/Jupiter onwards

1613073255646.png


1613073284126.png


1613073314967.png


Thank you for your time on this, and thanks for the heads-up re the spaces - I started using underscores for project folders over the last few months, but the main folders still have spaces.

Cheers,
Rich
 

Attachments

  • 1613073210735.png
    1613073210735.png
    43 KB · Views: 216
Can you try doing the following for me and then share the output of the previous commands again I mentioned in my other reply.
Code:
sudo chown pi. -R /mnt/Jupiter
 
Yep, have done so - however it's hanging on just a blank line, not sure if it's processing something..

1613075603970.png
 
Can you share the output of the following.
Code:
cat /etc/fstab
mount | grep  Jupiter
 
Not sure if these screenshots are worse than pasted text.. apologies if they're hard to read

1613076128495.png
 
1. Umount: sudo umount /mnt/Jupiter
2. Remove the one with afpfs and uncomment the original one with cifs in it.
3. Mount: sudo mount -v /mnt/Jupiter
4. ls -l /mnt
5. Share the output of points 3 and 4.

And is 192.168.1.56 your nas sharing a share through samba?
 
1613077154301.png


mount.cifs kernel mount options: ip=192.168.1.56,unc=\\192.168.1.56\Public,iocharset=utf8,file_mode=0777,dir_mode=0777,nodfs,vers=3.0,uid=1000,user=richard,pass=********


1613077094971.png
 
To the fstab line you of Jupiter can you add something: gid=, so that it looks like this:
192.168.1.56/Public /mnt/Jupiter cifs uid=pi,gid=pi,credentials=/etc/smbcredentials,iocharset=utf8,file_mode=0777,nodfs,vers=3.0
Then do the following and share the output.
Code:
umount /mnt/Jupiter
mount -v /mnt/Jupiter
ls -l /mnt
ls -l /mnt/Jupiter
ls -l /mnt/Jupiter/Caravan
ls -l "/mnt/Jupiter/Caravan/001 Caravan Projects"
 
I forgot something, can you run these again and share the output?
Code:
sudo umount /mnt/Jupiter
sudo mount -v /mnt/Jupiter
ls -l /mnt
ls -l /mnt/Jupiter
ls -l /mnt/Jupiter/Caravan
ls -l "/mnt/Jupiter/Caravan/001 Caravan Projects"
 
1613077938099.png

"mount.cifs kernel mount options: ip=192.168.1.56,unc=\\192.168.1.56\Public,iocharset=utf8,file_mode=0777,dir_mode=0777,nodfs,vers=3.0,uid=1000,gid=1000,user=richard,pass=********"

1613077969200.png




I forgot something, can you run these again and share the output?
Code:
sudo umount /mnt/Jupiter
sudo mount -v /mnt/Jupiter
ls -l /mnt
ls -l /mnt/Jupiter
ls -l /mnt/Jupiter/Caravan
ls -l "/mnt/Jupiter/Caravan/001 Caravan Projects"
 
Now change your second script(the one that is failing) to the following.
Bash:
#!/bin/bash

#sudo rsync -arvh --progress "/mnt/Jupiter/Caravan/001 Caravan Projects/" "/mnt/sde1/PROJECTS_300"
rsync -arvh --progress "/mnt/Jupiter/Caravan/001 Caravan Projects/" "/mnt/sde1/PROJECTS_300"
Then run it als normal user, so something like this:
Code:
./script.sh
Or whatever your script is located at and share the output.
 
Looks like it's started copying over!
It seems like you've corrected the user & groups within the mnt folders? They're all pi now! before they were a bit all over the place..

Is there a way of cancelling this, so I can run it via the crontab and see if it emails me a permission denied (13) message again?

(anecdotally, there was a chap who worked at Microsoft and wrote a backup utility, and called it Richcopy - i found this out after i'd named mine.)

1613078382332.png
 
You can just press: ctrl+d or ctrl+c to terminate it, then you can just adjust the time for your cronjob to sometime now so you can see if it runs correctly that way too.
 
Great, i've just crontabbed it and it's been a few minutes now with no permission denied email.
No news is good news I think for this, the whole backup will take a few hours as there's a good few 10's of GBs in there. I will report back with the crontabs results.
Feels like this is fixed, so in advance of the email I'd like to say a massive thanks! I've been living in fear of data loss because of the lack of a backup system over the last few months, so this is a huge relief.
Thank you mate, I will pass on this goodwill at the next opportunity
Rich
 


Top