goldfoxweb
Posts: 5
Joined: Tue Nov 06, 2012 7:48 am

setting permissions to a usb/nas mount

Thu Apr 18, 2013 8:08 am

I have set up 2 mount points on my pi 1 to a 32gb usb pen drive (mount /dev/sde1 /mnt/usb) and 1 to my nas (mount -t cifs //192.168.0.x/share /mnt/nas -o username=user,password=password)

The mounts are carried out by script called from the rc.local file that is run as soon as the pi powers on this the script is used to detect if the nas is up and running and if not mount the usb pen drive as a temp data store. this work well.

The problem I have is that I can only write to the devices if I am logged in as root but when logged in as a user (pi) I can see and read the directory’s and files but I can't write or create files. I have tried to set the permissions from SCP and locally but no joy.

I have set up a new mount point set it to full permissions for everyone (777) but as soon as I mount a device on it the permissions change to full for root and read only for the rest (755).

Is there any way I can mount the devices so that everyone gets full access.

Thanks in advance,
Adam

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5623
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: setting permissions to a usb/nas mount

Thu Apr 18, 2013 11:09 am

goldfoxweb wrote: ...
The mounts are carried out by script called from the rc.local file that is run as soon as the pi powers on this the script is used to detect if the nas is up and running and if not mount the usb pen drive as a temp data store. this work well.
Adam,
The more common approach to auto-mounting at boot time with set permissions is to edit and add suitable entries within /etc/fstab. Given your desire to check for the nas I can understand why you may not have done so. However, IIRC, "mnt" checks that file whenever it's used so it still may be useful to modify it. Just in case you're not familiar with that approach one of my webpages at http://www.cpmspectrepi.webspace.virgin ... ticks.html discusses some ideas about the auto-mounting of multiple USB sticks and also links to some info. in the wiki.
Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, and a A+) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

goldfoxweb
Posts: 5
Joined: Tue Nov 06, 2012 7:48 am

Re: setting permissions to a usb/nas mount

Thu Apr 18, 2013 11:31 am

thanks for that, i will give that a read and respond if need be.

I have found a solution for the NAS mount. If I add uid=pi option to the end of the mount command it allows me to access the directories and files as pi user.

(mount -t cifs //192.168.0.x/share /mnt/nas -o username=user,password=password,uid=pi)

thanks for the help,

Adam

Return to “Beginners”