[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Sheflug] Backing up from NT to Linux
On Thu, 2004-08-12 at 16:10 +0100, Chris Johnson wrote:
> I've used smbmount to mount my NT share "users" under Linux and have written
> a little cp batch file to copy across all the files from the folders under
> that "share" into the home folders of the matching users on the linux box.
> However the files are currently all owned by root. Instead of chowning them
> all after the copy is there a better way of copying them and giving them the
> correct owner all in one go?
>
You may want to look into smbtar and smbclient -T from the samba
package. Something like the command below may work
smbclient \\\\server\\share -Tc - username |tar -xvf -
or if that does not preserve the username this may work
smbclient \\\\server\\share -Tc - username/* |su username -c "tar -xvf
- -C /home/username/"
Basically making a tar file and piping to the stdout then untaring it. I
don't think that the first will get you any better than the cp you are
using but the second one should create the files as that user.
> I'm currently using cp -R -v -p mnt/source/username/* /home/username
>
Could do similar to above
cd mnt/source/username
tar -cf - * |su username -c "tar -xvf - -C /home/username/"
You may also want to look at rsync. I am not completley sure but it may
speed up the copy above if used locally. If you could install it on the
windows server, through cygwin it would definatly speed things up.
Hope that helps a bit!
john
___________________________________________________________________
Sheffield Linux User's Group -
http://www.sheflug.co.uk/mailfaq.html
GNU the choice of a complete generation.