peter pilsl
2009-Jun-09 08:06 UTC
[Samba] can samba keep uid/gid/permission on a per-file-base?
Is there a trick to copy files via smbfs and keep uid/gid/permissions? Usually uid/gid/permission of a transfered file depends on the uid used when mounting the remote share. But maybe there is a trick/patch whatever ... background: I'd like to use a linux-based NAS to backup loads of files *including their permissions and uid/gid*. The NAS supports NFS (which can do what I want) but the NFS-connections breaks all the time. So smbfs/cifs is my available option. * I need to backup the files on a per-file-base (and not in a tar-container) to make the backup-files easily and fast accessible from any thinkable client. * rsync via ssh would be my last option, but ssh has lot of overhead and invokes a key-managment-strategy for automatic backup thnx, peter
Alex Harrington
2009-Jun-09 08:37 UTC
[Samba] can samba keep uid/gid/permission on a per-file-base?
> Is there a trick to copy files via smbfs and keep uid/gid/permissions? > > Usually uid/gid/permission of a transfered file depends on > the uid used when mounting the remote share. But maybe there > is a trick/patch whatever ...I've used xcopy on Windows before to transfer files between shares maintaining permissions, owner, times etc. You need permission on the destination to be able to change those values though. I've never done that with Samba (always when doing Win32 server migrations) but I don't see any reason why it might not work... Cheers Alex -- Alex Harrington - Network Development Manager Longhill High School t: 01273 391672 e: alex@longhill.org.uk
charles
2009-Jun-09 15:22 UTC
[Samba] Re: can samba keep uid/gid/permission on a per-file-base?
> > > ---------- Forwarded message ---------- > From: peter pilsl <pilsl@goldfisch.at> > To: samba@lists.samba.org > Date: Tue, 9 Jun 2009 09:06:18 +0100 (GMT+01:00) > Subject: [Samba] can samba keep uid/gid/permission on a per-file-base? > > Is there a trick to copy files via smbfs and keep uid/gid/permissions? > > Usually uid/gid/permission of a transfered file depends on the uid used > when mounting the remote share. But maybe there is a trick/patch whatever > ... > > background: > > I'd like to use a linux-based NAS to backup loads of files *including their > permissions and uid/gid*. The NAS supports NFS (which can do what I want) > but the NFS-connections breaks all the time. > > So smbfs/cifs is my available option. > > * I need to backup the files on a per-file-base (and not in a > tar-container) to make the backup-files easily and fast accessible from any > thinkable client. > * rsync via ssh would be my last option, but ssh has lot of overhead and > invokes a key-managment-strategy for automatic backup > > thnx, > peter > > > > Hi,I've recently gave a similar setup a shot. The group and user id's will remain. You can test the gid/uid they'll be the same on both boxes. However the permissions weren't quite what I needed them to be; it seems to use the umask of the "samba authenticated user" and ignore smb.conf create masks. For you're purposes, I'd suggest rsync+sshfs OR "cp -p --parents -u -f /source /dest" + sshfs. It is up to you but rsync is made to do what it seems like you require. Although you'll need to worry about keys for ssh you'd also have to worry about passwords for samba. good luck. -- Charles Belmopan, Belize "... we just love cars and we love driving them!"
Edward Ned Harvey
2009-Jun-09 17:54 UTC
[Samba] can samba keep uid/gid/permission on a per-file-base?
> I'd like to use a linux-based NAS to backup loads of files *including > their permissions and uid/gid*. The NAS supports NFS (which can do > what I want) but the NFS-connections breaks all the time.This is a strangely common question recently. I'll paste here, the response I wrote in some other message. If you're having NFS reliability problems, it's due to misconfigured NFS. Below is the config that I deploy to all the locations where I do their IT, because after zillions of hours of manual reading, testing and usage - it's a tried & tested rock solid config for linux-to-linux nfs filesharing. Assuming you're on Linux, I'll suggest the following NFS options in your exports file, and then I think I better butt-out, because this is a samba mailing list: man exports # On a server that has a caching raid controller card, you want sync,no_wdelay # On a server that has a simple disk, you want async (no_wdelay has no effect, so you can omit it.) /share 10.1.100.0/23(sync,no_wdelay,rw,no_root_squash) And I'll suggest the following options on the nfs client: Use automount. Assuming automount 5 you can use auto.direct as below, otherwise create an automount directory as expected in automount 4. /etc/auto.master /- /etc/auto.direct --timeout=1200 /etc/auto.direct /share -fstype=nfs,rw,hard,intr,posix fileserver:/share If you take my advice here, you'll have a NFS hard mount on the client (therefore resilient) combined with interruptable auto dismount (therefore self healing).