Samba and user rights configuration


I get a pi 2 with an usb hard drive connected to (EXT4 format)

The pi and my pc (windows 7) are connected to my router

From my PC i can access the usb hard drive via network share but i don’t have rights to write on it (read only)

i use latest OSMC release (RC 3), i downloaded Samba server from app store, and that’s all

here is my smb.conf :

config file = /etc/samba/smb-local.conf
workgroup = WORKGROUP
follow symlinks = yes
wide links = no
unix extensions = no
lock directory = /var/cache/samba
load printers = no
printing = bsd
printcap name = /dev/null
disable spoolss = yes
log level = 1
map to guest = bad user
usershare template share = automount template
read raw = Yes
write raw = Yes
strict locking = no
min receivefile size = 16384
use sendfile = true
aio read size = 2048
aio write size = 2048
browsable = yes
read only = no
valid users = osmc
path = /home/osmc
comment = OSMC Home Directory
[automount template]
browseable = yes
-valid = no
valid users = osmc
path = %P
hide files = /$RECYCLE.BIN/System Volume Information/desktop.ini/thumbs.db/
include = /etc/samba/smb-shares.conf

What sould i do to access my hard drive with write rights ? i searched a solution for a little time but found nothing revelant and don’t have many time to spend on this, so help would be much appreciate.

Sorry for my english :smile:

For an ext4 external drive you will need to set the correct permissions on the drive itself so that the osmc user can write to the disk. (Samba and Kodi both write to disk as osmc) To do that:

sudo chmod a+rwx /media/mydrive

Where mydrive is the name that your drive mounts as.

Optionally, if it is only a data drive (movies etc) you might want all files on the drive to be owned by the osmc user so that existing files can be deleted and modified via Samba: (and also from Kodi)

sudo chown -R osmc:osmc /media/mydrive

Thank you very much for your answer, i’ll do it tonight :smile:

My drive has a name with many letters and numbers separate by tirets, this is the name i must use ?

Is there a way to change it ?

For an ext4 drive you’ll want to use the e2label command to give it a name, then it will mount under that name in future. When it has no name it is mounted under its UDID. (A long string of letters and numbers)

it works ! :wink: ty very much