2

I have setup Samba on Pi and I have added the users to the sambashare group in /etc/group. I want to assign read and write permissions to the users in this group so that they can create new files and modify it in using Samba client Is there any way to assign read write permissions to a group?

  • This may not be applicable, but are you sure the filesystem itself is RW? In particular, if you're mounting NTFS as root, it may not be writable by others. You mention below that it's a USB drive. What filesystem? – bobstro Jul 24 '15 at 2:27
1

You have to define the scope of your question, because you can set permissions on any directory you choose.

You will have to set permissions on the directory in question correctly, but also ensure that you haven't marked your Samba share as read-only.

First, you want to set the read only directive to no in your Samba configuration. For example, say you have an upload share. Edit your Samba configuration to set read only to no in the share:

[upload]
    path = /path/to/directory
    comment = Upload directory
    read only = no

After you do this, you will want to grant write permission on the directory for the Samba share to the sambashare group. Using the upload share from above, you would need to set the permissions/ownership of the /path/to/directory directory:

~> chown :sambashare /path/to/directory
~> chmod g+w /path/to/directory

The chown line sets the group ownership of the directory (to the sambashare group), and the chmod line grants write permission to the owner group (now the sambashare group). I am assuming that you don't need to modify your permissions further on the directory.

0

Directory: /home/myuser/myshare
User: myuser
Group: sambashare

Try this:

  • ADD myuser to the group

    sudo usermod -a -G sambashare myuser
    
  • Change the ownership of the folder

    sudo chgrp mygroup /home/myuser/myshare
    
  • Give read/write access

    sudo chmod 770 /home/myuser/myshare
    
0

Assuming the users exist on the Pi and are in the group sambashare, I would add:

validusers = @sambashare  #or name of the group to the share definition in smb.conf as in 

https://www.samba.org/samba/docs/using_samba/ch09.html

  • i have already tried all this .but still i am getting the same issue – radhika Feb 24 '15 at 12:46
  • and i have shared the usb drive's directory.also i am using usbmount package which will automount the pendrive to /media/usb location when plugged in.is that of any issue ?also when i try to change the ownership of /media/usb using chown i get an error "/media/usb is not a block device" please help – radhika Feb 24 '15 at 12:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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