Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 04-22-2009, 02:32 AM   #1
LQ Newbie
Registered: Sep 2008
Posts: 26

Rep: Reputation: 15
Synchronizing files from a ntfs share to samba

I have a ftp server in a dmz that synchronizes files against a ntfs drive outside the dmz. I've locked the users to their home directories. The sync scripts are running from a ntfs server. I've tried several things to get the synchronization to work. Since the ftp server is in a dmz we want no passwords and stuff like that to be stored on it. So I've set samba to open for guest:
comment = FTP Share
path = /mnt/ftproot/
guest ok = yes
writable = yes
public = yes
guest ok = yes
directory mask = 0777
read raw = yes
browseable = yes
read only = no

In order to get the synchronization to work the files in the ftp share needs to be 777, so that the unauthorized windows user that runs the script can write to it. The problem is:

1. When I use the solution where I link the home directories (ln -s /home/username/out /mnt/ftproot/out/username) I get an error when I log on to the ftp server: 550 Failed to change directory
With this solution the synchronization script work.

2. The other solution I've tried is to bind the home directory against the ftproot( mount --bind /home/username/out /mnt/ftproot/out/username )
When I do this, the user in the ftpserver becomes the owner of the folder, and then the synchronization failes.

Any clues anyone? Starting to get a little frustrated here.
Old 04-22-2009, 06:50 AM   #2
Registered: Jun 2007
Distribution: Fedora, RHEL, Centos
Posts: 294

Rep: Reputation: 54
I did a similar project recently where I had to keep Windows file server sync'ed with an FTP server in the DMZ for about 2 months while people were being migrated off the Windows server. I did it a little differently but the results worked.
I used a 3rd Linux box that was inside the network to mount the Windows server via CIFS, then used lftp to sync the files from the Windows server to the DMZ ftp server with command:
mount -t cifs //Windows_server/sharename/userfolder /mnt/ftpsync
cd /mnt/ftpsync
`lftp -c 'open -e "mirror -R --delete-first . ." ftp://usernameassword@DMZ_FTP_Server'`

And then I iterated for each user. The benefit here is the file permissions get set correctly.
You could do something different, but if you don't know the username+password for each user, simply bulk copy all the data using scp or ftp or whatever, then run a script to chown -R the permissions to each subfolder.

The other thing you could do if you wanted to run this from the Windows box (i assume that what you mean by ntfs server), is to script winscp to scp the files over, then use plink to script changing the file/folder perms.

I don't think your step 1 will work, because ftp won't be allowed to follow a link outside of the chroot'ed base folder. (chroot - i assume that's what you mean by locking the users to their home folder)

Your step 2) I don't know about. I have never used the "--bind" for mounting anything.
Old 04-23-2009, 02:14 AM   #3
LQ Newbie
Registered: Sep 2008
Posts: 26

Original Poster
Rep: Reputation: 15
Thanks for your answer. I'll try the winscp solution first!


chmod, ftp, samba, windows

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to share ntfs files with linux mangal Linux - Software 4 01-25-2007 07:43 PM
Samba share ntfs mount sqrt Linux - Software 2 11-22-2006 04:40 PM
Linux Backup to Samba share on Windows NTFS DBThomson Linux - General 1 09-23-2005 04:01 AM
Samba > Trouble mounting remote NTFS share Harlin Linux - Software 6 06-20-2005 08:07 PM
accessing ntfs share through samba GraemeK Linux - Software 2 01-26-2004 10:15 AM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:15 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration