0

I have a raspberry with samba and it shares a drive inside the network and allow to everyone to write, read etc

I have another raspberry which mount the samba shared drive and I would execute, from this second raspberry, a chown on a folder but I don't have the permission.

I am going to set owncloud on the second raspberry which has to allow a user to own a folder.

On both Raspberry there is the default pi user, sambaRaspi has the following configuration

My smb config:

[MyAwesomeShare]

comment = MyAwesomeShare
path = /mnt/HDD
writeable = yes

cloudRaspi (raspberry with owncloud) mounts the samba share

//IP/MyAwesomeShare /mnt/SAMBA_SHARED_HDD  cifs username=pi,password=MyPassword,uid=1000,gid=1000  0  0

cloudRaspi need to run chown on the samba share

  • You should really post your smb.conf file to make it clear what you're doing exactly. Hint: create the same user on both Raspberries, so you don't have to chown at all. – Dmitry Grigoryev Oct 17 '16 at 12:26
  • @DmitryGrigoryev what do you mean with "create the same user on both Raspberries" ? – user4789408 Oct 17 '16 at 14:27
  • Just curios what is the filesystem of the device mounted at /mnt/HDD? If I am not mistaken fs like vfat or exfat do not support elaborate access metadata. So no chmod and chown there. Files will belong to the user who mounted the device (or is set in fstab). – Ghanima Oct 17 '16 at 16:49
  • @Ghanima the filesystem is ext3 – user4789408 Oct 17 '16 at 17:49
  • Very well, then this should not be part of the problem. – Ghanima Oct 17 '16 at 18:03
0

I believe you'll have to create a new user (with adduser) on the RPi running samba, to match the user which runs OwnCloud on the other RPi.

As such, there are at least two possible ways to get correct permissions:

  1. Change ownership of /mnt/HDD to the right user on the samba server.

  2. Let the right user to create a new folder on the samba share. This would require /mnt/HDD to have write permissions for users of the share. Any directory created by those users will be owned by them automatically.

  • what do you mean with "create a new user"? I tried to create the user on both Pi with the same name and it didn't worked, I also tried changing permission but without results – user4789408 Oct 17 '16 at 18:02
0

Let's say,

  • raspiSamba is the raspi on which a samba server is running
  • /mnt/HDD is a directory on raspiSamba
  • userX is a OS level user on raspiSamba
  • raspiCloud is the raspi on which owncloud is running
  • /mnt/mycloud is the mount point on raspiCloud
  • cloudUser is a OS level user (and also owncloud user) on raspiCloud

For the first 2 steps, forget about raspiCloud, we are on raspiSamba.

Step #1: Be sure that Linux system permissions are OK for userX to read and write /mnt/HDD, because system permissions have higher priority than Samba permissions.

Step #2: Check your Samba permissions for /mnt/HDD and userX. It should be something like the following:

[MyAwesomeShare]
comment = MyAwesomeShare
path = /mnt/HDD
write list = userX

Now, forget about raspiSamba and focus on raspiCloud. We are on raspiCloud.

Step #3: Be sure that the OS level owner of /mnt/mycloud is cloudUser.

Step #4: (as root) Mount raspiCloud:/mnt/HDD onto /mnt/mycloud with the credentials of userX. We don't need to have a userX user on raspiCloud. We just need to know its credentials. Here is an example of mount command:

mount -t cifs //raspiSamba/MyAwesomeShare /mnt/mycloud -o user=userX,pass=XXXX

As the final picture,

  • /mnt/mycloud is owned by cloudUser who is an owncloud user from the perspective of raspiCloud.
  • /mnt/mycloud is mapped to raspiCloud:/mnt/HDD as userX from the perspective of raspiSamba.

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.