pacmyc
Posts: 4
Joined: Tue Aug 28, 2012 7:03 pm

Samba server, permissions problem

Thu Aug 30, 2012 7:48 pm

I followed this guide http://elinux.org/R-Pi_NAS to set up my Raspberry pi
as a samba server. I have a USB stick mounted that I want to share with all users in my LAN, with read+write permissions.
In the file /etc/samba/smb.conf I set the line

path = /mnt/USB_dir . (This folder i mounted to the USB drive in my /etc/fstab file)

The share works. I can see it from my win xp computer and it shows 2 shared folders.
one of them is "pi" (probably because first time i connected from windows i logged into to the folder with the pi/raspberry login, and pi folder is home folder for the user pi).
I also see my shared USB drive. I can browse the directories, I see all files etc. But I have no write permission on the USB flashdrive.
But, I have write permission in my "pi" folder.

In the log file (var/log/samba/log.<ClientComputerName>)

[2012/08/30 19:51:19.590639, 0] param/loadparm.c:9114(process_usershare_file)
process_usershare_file: stat of /var/lib/samba/usershares/usb_dir failed. Permission denied


Any ideas?

bredman
Posts: 1415
Joined: Tue Jan 17, 2012 2:38 pm

Re: Samba server, permissions problem

Thu Aug 30, 2012 9:21 pm

Is the USB drive formatted as Linux or Windows?

How have you mounted the USB drive? Show us the line in the fstab file.

Do you get an error if you try this command?
echo "Testing" > /mnt/USB_dir/test.txt

pacmyc
Posts: 4
Joined: Tue Aug 28, 2012 7:03 pm

Re: Samba server, permissions problem

Fri Aug 31, 2012 6:34 am

Is the USB drive formatted as Linux or Windows?
Fat32
How have you mounted the USB drive? Show us the line in the fstab file.
/dev/sdb1 /mnt/USB_dir vfat defaults 0 0
Do you get an error if you try this command?
echo "Testing" > /mnt/USB_dir/test.txt
Im at work right now so I can't test it. But I know for sure that I can write to the USB flashdrive from my raspberry (logged on as pi). ( I tried sudo mkdir /mnt/USB_dir/testFolder )

bredman
Posts: 1415
Joined: Tue Jan 17, 2012 2:38 pm

Re: Samba server, permissions problem

Fri Aug 31, 2012 8:10 am

With your fstab settings, a normal user cannot write to the USB drive, this is why you needed sudo to gain extra privilege.

For a FAT device, you need to specify the userid and group id in the fstab file, use something like
uid=pi,gid=pi

For an example of how to mount a FAT drive, see
http://en.wikipedia.org/wiki/fstab

pacmyc
Posts: 4
Joined: Tue Aug 28, 2012 7:03 pm

Re: Samba server, permissions problem

Sun Sep 02, 2012 6:23 pm

For a FAT device, you need to specify the userid and group id in the fstab file, use something like
uid=pi,gid=pi
Thanx! That worked it out!

Return to “Troubleshooting”