dan142
Posts: 4
Joined: Wed Apr 10, 2013 5:43 pm

Permission issues

Wed Apr 10, 2013 6:27 pm

Hi,

I have been trying to set up a Samba share on my Pi using this tutorial http://simonthepiman.com/how_to_setup_w ... server.php. I have followed it before to a success, but the SD card that was on went missing, so I'm starting all over again.

My basic requirements for the server is that it shares the USB Pen Drive (16gb SanDisk Cruzer) to everyone who is on the network (or in the workgroup), all with read, write, and execute permissions. I have managed to get read permissions to work, but I get "Permission Denied" when trying to write or execute.

I have mounted my USB drive to /mnt/share, which is the directory I am having issues with. I have used chmod to set the permissions for this directory to 777, but still only the root user seems to be able to write or execute. I have tried to chown the /share directory to be owned by pi (the default user), but it returns "Operation not permitted", even as root. I cant even modify my test file if I am not the root user, despite changing the permissions to 777.

Below is the line for my USB drive in /etc/fstab:

Code: Select all

/dev/sdb1     /mnt/share     vfat     gid=pi,uid=pi,umask=777,noatime     0     0
As you can see, I have been browsing around for solutions for an extensive amount of time, and have attempted to apply some here, to no avail. I found another post on this forum adressing a similar issue to mine, but none of the fixes there worked either http://www.raspberrypi.org/phpBB3//view ... 36&t=15864

I won't bother including my Samba configuration file, as I think the fact that not even the default non-root user can write or execute indicates that the issue is with permissions, and not Samba.

I have seen somewhere that this issue would be caused if the drive uses a read-only file system, but by virtue of the fact that I have created a file as the root user, and I can create files on it when the drive is plugged in to my Windows 7 laptop, I doubt this is the issue.

I ran ls -l /mnt/ to find out more about the permissions of my share folder and its ownership, and it returned the following:

Code: Select all

drwxr-xr-x 2 root root 8192 Apr 10 17:05 share
This prompted me to attempt to chown the directory to remove ownership from root, but as I said above, "Operation not permitted".

Any help would be greatly appreciated, as I really have exhausted every suggestion I can find on Google and every little bit of my limited Linux knowledge.

Thanks in anticipation,

Dan.

sdjf
Posts: 1395
Joined: Fri Mar 16, 2012 5:20 am
Location: California
Contact: Website

Re: Permission issues

Thu Apr 11, 2013 3:24 pm

Try this and see if your ls -l improves:

sudo chmod a+rwx /mnt/share

The a+ should give everyone all permissions...I hope.

(if you are logged in as root, you will not need sudo and can omit the work in command).
FORUM TIP: To view someone's posting history, sign in, click on their user name, then on "Search User's Posts." || Running ArchLinuxArm on Model 2B and 512MB Model B

chris57100
Posts: 522
Joined: Wed Sep 12, 2012 7:23 pm
Location: Thionville
Contact: Website

Re: Permission issues

Fri Apr 12, 2013 2:33 pm

You have to create the folder with the user used to mount the partition. The mount will not overwrite this ownership and rights. Only the content of the mounted partition will use this rights
Also on most modern linux distributions, the chown is for the root user so that's why you have the permission denied message
So first unmount the partition, do the chown with sudo, do the chmod with sudo and do again the mount

Hope it helps
Raspberry Pi Home Server : http://www.pihomeserver.fr
Software and electronic tutorials : Samba, Airplay, CUPS, Time machine, Nginx, Owncloud, rTorrent, Wordpress, etc.
Full Wi-Fi hotspot installation on a RPi 3 including a captive portal and freeradius management: https://github.com/pihomeserver/Kupiki-Hotspot-Script

TheQuestor
Posts: 80
Joined: Wed Nov 28, 2012 9:15 am

Re: Permission issues

Fri Apr 12, 2013 4:49 pm

sudo mkdir /mnt/share
sudo chown -R pi /mnt/share
chmod -R 777 /mnt

[fstab]
/dev/sdb1 /mnt/share vfat rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0077 0 4

works for me anyway and using the above I can share it with samba and it's able to be used by my other machines too

dan142
Posts: 4
Joined: Wed Apr 10, 2013 5:43 pm

Re: Permission issues

Sat Apr 13, 2013 6:00 pm

sdjf wrote:Try this and see if your ls -l improves:

sudo chmod a+rwx /mnt/share

The a+ should give everyone all permissions...I hope.

(if you are logged in as root, you will not need sudo and can omit the work in command).
Thanks for the advice. I tried this and the output changed to:

Code: Select all

d---------     2     pi     pi     8192     Jan     1    1970
The difference being that nobody except root can even read anymore, and my samba share returns "Permission Denied" when I try to even access it.

TheQuestor
Posts: 80
Joined: Wed Nov 28, 2012 9:15 am

Re: Permission issues

Sat Apr 13, 2013 6:22 pm

dan142 wrote:
sdjf wrote:Try this and see if your ls -l improves:

sudo chmod a+rwx /mnt/share

The a+ should give everyone all permissions...I hope.

(if you are logged in as root, you will not need sudo and can omit the work in command).
Thanks for the advice. I tried this and the output changed to:

Code: Select all

d---------     2     pi     pi     8192     Jan     1    1970
The difference being that nobody except root can even read anymore, and my samba share returns "Permission Denied" when I try to even access it.
Like I said before :)

add this to your fstab
/dev/sdb1 /mnt/share vfat rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0077 0 4

[your sdb might be different]

then add this to the bottom of your /etc/samba/smb.conf

[Bailar]
comment = Bailar Shared
read only = no
path = /mnt/share
guest ok = yes
create mask = 0755
browseable = yes
directory mask = 0755


I have 0 problems accessing the shared from any of my win7/win8/osx/Linux machines.

User avatar
jojopi
Posts: 3077
Joined: Tue Oct 11, 2011 8:38 pm

Re: Permission issues

Sat Apr 13, 2013 6:29 pm

dan142 wrote:d--------- 2 pi pi 8192 Jan 1 1970
That is exactly what you originally asked for in fstab: gid=pi,uid=pi,umask=777.

umask is the permissions not granted, and you really wanted umask=022. (Or dmask=022,fmask=0133 for non-directories not to have execute permission.)

dan142
Posts: 4
Joined: Wed Apr 10, 2013 5:43 pm

Re: Permission issues

Sat Apr 13, 2013 7:28 pm

TheQuestor wrote:
dan142 wrote:
sdjf wrote:Try this and see if your ls -l improves:

sudo chmod a+rwx /mnt/share

The a+ should give everyone all permissions...I hope.

(if you are logged in as root, you will not need sudo and can omit the work in command).
Thanks for the advice. I tried this and the output changed to:

Code: Select all

d---------     2     pi     pi     8192     Jan     1    1970
The difference being that nobody except root can even read anymore, and my samba share returns "Permission Denied" when I try to even access it.
Like I said before :)

add this to your fstab
/dev/sdb1 /mnt/share vfat rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0077 0 4

[your sdb might be different]

then add this to the bottom of your /etc/samba/smb.conf

[Bailar]
comment = Bailar Shared
read only = no
path = /mnt/share
guest ok = yes
create mask = 0755
browseable = yes
directory mask = 0755


I have 0 problems accessing the shared from any of my win7/win8/osx/Linux machines.
Ok, my fstab is now exactly that, and my smb.conf share matches that also. I am still completely denied access to my drive if I'm not root. The odd thing is that I had this working on my old SD with the default settings, but this time it hasnt worked. :/

dan142
Posts: 4
Joined: Wed Apr 10, 2013 5:43 pm

Re: Permission issues

Sun Apr 14, 2013 1:23 am

Right, I have reached a solution to the issue. It's not exactly the way you're supposed to do it but hey. I plugged the SD into my Ubuntu 12.10 Netbook, and ran Nautilus as root. Then I just removed any user or group association, and gave read- write access to everyone in properties. Bit of an improvisation, but at least it works! Thanks for all your help anyway guys.

User avatar
jojopi
Posts: 3077
Joined: Tue Oct 11, 2011 8:38 pm

Re: Permission issues

Sun Apr 14, 2013 2:08 am

/mnt/share was a vfat filesystem, so it had no user, group, or permissions except those faked when mounting. After changing /etc/fstab, you just needed to remount it to update the permissions.

Have you trashed the permissions on the system SD card? If so you will need to reimage.

anand24nov
Posts: 1
Joined: Fri Nov 01, 2013 9:30 pm

Re: Permission issues

Fri Nov 01, 2013 9:39 pm

Hi,

I am trying to setup a media server on RPI using minidlna and debian. I have connected a pendrive which contains all my music and videos. I have changed the /etc/minidlna.conf to :

media_dir=V,/mnt/video/

created a new directory in mnt using sudo mkdir /mnt/video

[email protected] / $ cd mnt/
[email protected] /mnt $ ls -l
total 4
drwxr-xr-x 2 root root 4096 Nov 1 21:25 video

it shows user as root:root

Then,
mounted my /dev/sdb to /mnt/video
When I start the minidlna service I get following error:

[2013/11/01 21:29:13] playlist.c:125: warn: Parsing playlists...
[2013/11/01 21:29:14] inotify.c:89: error: inotify_add_watch(/mnt/video) [Permission denied]
[2013/11/01 21:29:14] inotify.c:89: error: inotify_add_watch(/mnt/video) [Permission denied]

and now the permission changed to :

[email protected] /mnt $ ls -l
total 4
drwx------ 6 pi pi 4096 Jan 1 1970 video

Please help!

Return to “Advanced users”