Author Topic: Upload files to samba share problem  (Read 2413 times)

spst

  • Zen Apprentice
  • *
  • Posts: 21
  • Karma: +3/-0
    • View Profile
Upload files to samba share problem
« on: August 25, 2019, 08:04:52 pm »
Hi,

I installed and configured Zentyal 6 Samba PDC with latest updates. Everything works but I would like upload to samba share my dirs and files from other samba share.

My problem is I tried it but I can't access to share. I used rsync on console for upload.  I used to verify ls -ln for what user is owner on samba share and I changed dirs and files owner on console by chmod -R 65537:2513 /home/samba/shares/share01.

Now, I can not access samba share but all directory owners and permission are same.

How can I change the owner on samba share's dirs and files correctly? And file's permission?

Thank you for help.

doncamilo

  • Zen Samurai
  • ****
  • Posts: 478
  • Karma: +165/-1
    • View Profile
Re: Upload files to samba share problem
« Reply #1 on: August 26, 2019, 12:54:00 pm »
 :)

First you have to understand the Zentyal architecture. Zentyal writes his configuration values on a redis database and populates with these data values some templates ('stubs') in order to generate the configuration files (for instance /etc/samba/smb.conf). So Zentyal doesn't read the real configuration of the services you changes manually, and when restarting the service, your customized files simply are overwrited. Read https://doc.zentyal.org/en/appendix-c.html#stubs

You should create the shared resource you want copy on Zentyal webadmin with the same permissions and names. Afterwards you can use rsync or simply tar with the right shared path:

Code: [Select]
sudo tar --acls -cpPzf shared_resource.tar.gz shared_resource # in order to copy on the old server
sudo tar --acls -xzpPf shared_resource.tar.gz #on the new server

This way zentyal webadmin will generates the right samba configuration and you'll reach your goal.

Cheers!
- Do my pigeons bother you passing over your land?
- They block the sun!

G. Guareschi., Don Camillo.,

spst

  • Zen Apprentice
  • *
  • Posts: 21
  • Karma: +3/-0
    • View Profile
Re: Upload files to samba share problem
« Reply #2 on: August 28, 2019, 09:07:34 pm »
Dear doncamilo,

thank you for your advice and information. I think it will be work if I want move dirs and files beetwen two zentyal shares.

I think I didn't definied my problem egxactly. Sorry. My problem is different because I have an suse server with samba share and I tought I'm going to to use zentyal instead suse's samba share. I don't use LDAP authentication samba users are linux users on suse .  For this I need to move all dirs and files from suse to zentyal (56 GB). I can move it by rsync or scp... I can not setup ACLs on suse before I uploading the files to the zentyal.

I uploaded dirs and files but I have problem to access the samba share what I wrote it...

I'm looking for a solution for solve this problem. I preferred linux command line. Do you have any idea?

Thank you for any help.

Regards.

doncamilo

  • Zen Samurai
  • ****
  • Posts: 478
  • Karma: +165/-1
    • View Profile
Re: Upload files to samba share problem
« Reply #3 on: September 03, 2019, 05:03:04 pm »
 :)

Here you have the permissions that Zentyal configures for a  shared resource.

Code: [Select]
root@zen6:~# getfacl /home/samba/shares/sistemas/
getfacl: Removing leading '/' from absolute path names
# file: home/samba/shares/sistemas/
# owner: LAB6\134administrator
# group: adm
user::rwx
user:LAB6\134administrator:rwx
user:LAB6\134abraham:rwx
user:LAB6\134andrea:rwx
group::rwx
group:adm:rwx
group:LAB6\134domain\040admins:rwx
mask::rwx
other::---
default:user::rwx
default:user:LAB6\134administrator:rwx
default:user:LAB6\134abraham:rwx
default:user:LAB6\134andrea:rwx
default:group::rwx
default:group:adm:rwx
default:group:LAB6\134domain\040admins:rwx
default:mask::rwx
default:other::---
# unix permissions
root@zen6:~# ls -l /home
total 28
(...)
drwxrwx---+  4 root          LAB6\domain users 4096 feb  2  2019 samba

root@zen6:~# ls -al /home/samba/shares/
total 16
(...)
drwxrwx---+ 2 LAB6\administrator adm               4096 sep  2 14:42 sistemas

You can see how (in addition to the ACLs) the unix permissions system grants rwx access on /home/samba folder to the 'root' user and the domain users. In addition the /home/samba/shares/sistemas grants access to the domain administrator and the local group 'adm'.

You will should enable the Zentyal root user and add it to the adm group (however you'll have issues with the suse file owners, etc due to the acl's on Zentyal...)

I think that your best option could be to upload the resources from SUSE to Zentyal in your administrative user home in order to migrate them to  the shared resource created through webadmin (Zentyal will not recognizes it if you create the resource "manually") after the creation of the domain user accounts of the files and folders owners you have  to grant access to the resource (through webadmin too)

If you makes a list of the owners of the files on SUSE you could make easily a bash script in order to transfer the ownership of each one of the files and folder to the correspondant users of your new domain after copying all of them on the shared resource with a domain user with rwx permissions on the shared resource.

I don't know if I have understood your problem correctly now.

PS: Tell me if you need some help with this process.

Cheers!
« Last Edit: September 03, 2019, 05:08:13 pm by doncamilo »
- Do my pigeons bother you passing over your land?
- They block the sun!

G. Guareschi., Don Camillo.,