8

I am following this tutorial to create Samba Share on my Raspberry Pi Zero.

My problem is at this step:

"Make sure your user is the owner of the path you are trying to share via Samba sudo chown -R pi:pi /path/to/share"

Error message: Operation not permitted.

I have also tried it as superuser (sudo su), but with the same error.

If I type mount in the terminal, the output regarding the external harddrive is:

/dev/sda2 on /home/pi/HDD type vfat
(rw,noatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,
shortname=mixed,errors=remount-ro)

Googled a bit and found this post, so I tried this without any error messages:

$ mount -o remount,gid=1000,uid=1000 /home/pi/HDD

Typing mount in the terminal after this gives the same output as before.

Posted this on stackoverflow first by mistake, and got this answer:

Voted to close as off-topic for StackOverflow. vfat doesn't support ownership and groups, hence the operation not permitted. Remove the -R from the chown command. Ask on Serverfault if you still have a problem. – Alastair McCormack

Removed the -R, but still not working. Serverfault is not the place for this question, so asking it here instead.

What am I doing wrong?

1 Answer 1

9

You are probably not doing anything wrong. It seems to me that the real issue is that the instructions, as written, don't work generically. The point at which you are apparently stuck is the chown command, but all that is intended to accomplish is to make sure that "you" (really the pi user) actually owns the folder to be shared.

If you created the /home/pi/HDD directory while logged in as the pi user, and before mounting the external drive, that's already done, so you can simply skip that step. As already mentioned in the answer you got, the FAT file system doesn't support such permissions, so they can't be applied after the drive is mounted.

If you're going to add this mount to your /etc/fstab file and still want it mounted by the pi user, then you'll need to specify the uid and gid on the line. For example:

/dev/sda2         /home/pi/HDD       ntfs-3g     defaults,user,uid=1000,gid=1000,noatime      0        0

Note that this assumes that the pi user is user 1000. (Check that by issuing the id command when logged in as pi.)

2
  • Thanks for your answer. Removed the link between /home/pi/HDD and the external hard drive, changed permissions on the folder with chown command. Works until reboot, then the owner of the folder is back to root. May add that i used this guide for mounting the external hard drive. Any ideas? @Edward
    – bac
    Commented Jan 5, 2016 at 10:37
  • I've added a section to my answer to address that.
    – Edward
    Commented Jan 5, 2016 at 15:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.