Samba is this possible?

Hi,

I am using RPI1 and its external USB hard drive as a backup device.
From RPI1 by using rsync (-aPhv) I am copying files from different linux machines to RPI1’s /mnt/backup folder.
On RPI1 I would like to share /mnt/backup folder by samba to windows user “boda”.
The problem is that by rsync-ing files from different linux machines to the RPI1, files are owned by users/groups that don’t exist on RPI1.

In order to enable access to the all files on the RPI1’s /mnt/backup folder I have setup samba on RPI1 in the following way:
smb.conf
[global]
security = user
username map = /etc/samba/username.map

[backup]
path = /mnt/wdg2tb/backup
browsable = yes
read only = yes
writeable = no
valid users = boda
username = boda

/etc/samba/username.map
root = boda

My idea is to enable to the user “boda” a read only access to the all files in the share. At the same time I would to preserve all permissions in the case of the restore.

With above setup, I cannot access the backup share. Journalctl says „smbd[24300]: pam_unix(samba:session): session closed for user nobody“.

Is it possible to get access to all files in the share even if these files are owned by users that are not created on the RPI1?

Regards.

Do not use Samba if you are sharing the drives Pi to Pi. Use NFS, as it’s a native linux protocol.

If you also need to share with Windows systems, you can use both, use NFS for Pi to Pi and Samba for Pi to Windows.

I have to share from PI to Windows user, so samba is my only option. I don’t know how to setup samba share to be accessible by only one windows user regardless of the PI’s file permissions (some files are owned by uses that don’t exist on the PI).
i tried username map option with no success.

I have found the following link which offers a solution.

http://www.agix.com.au/give-a-user-complete-access-to-samba-share-contents-regardless-of-local-permissions/

In my setup, I discarded username map file and I created a samba user root.
The share is set up as the following:

[backup]
path = /path/to/backup/folder
browsable = yes
read only = yes
writeable = no
valid users = root

If user logs to this share as a root user, he will be able to read everything, but still without write permission, and that was my goal.

I hope this will help to someone.

Good that you found a solution, but I still say that you should setup NFS for the sharing between the Pi’s. You can still use Samba to share with the Windows system, but using NFS is better for linux to linux sharing.

I cannot use NFS because only one single windows user should have access to the PI backup share.