<

Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x

How to add NTFS volume with NTFS-3G and use it for VSFTPD anonymous upload

Published on
11,619 Points
5,519 Views
1 Endorsement
Last Modified:
I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.  

IT can be done and here's how to get it working:

In this example, I have an external NTFS Gigabyte drive that I called "Store01".  This volume contains a directory called "/ftp".  Anonymous ftp clients should be able to upload to what is seen thru FTP as "/ftp/pub", and I want these files to actually show up in /ftp on my external NTFS drive.

The first requirement is that vsftpd wants the anonymous root directory to be owned by ftp:ftp

You'll need to find the right id so look in the user file to find the id for ftp. In this case:
cat /etc/passwd

Open in new window

Again, in this case my system ftp is userid 14

Next look in the groups file to find the id for the ftp group:
cat /etc/group

Open in new window

In this example, the ftp group is 50

Next, look to see what device name my NTFS volume has:
fdisk -l

Open in new window

On my system, my NTFS volume is shown to be called: /dev/sdc1

Now create a mount point for it thus (I'm arbitrarily calling it "Store01":
mkdir /mnt/Store01

Open in new window


in /etc/fstab, this line gets the NTFS volume mounted at /mnt/Store01:
/dev/sdc1    /mnt/Store01    ntfs-3g    nls=utf8,auto,user,rw,uid=14,gid=50,umask=0000,defaults 0 0

Open in new window

Note that it is going to belong to user 14, which is ftp on my system, and group 50, which is ftp on my system.  VSFTPD requires that anonymous upload directories to belong to ftp:ftp

Now define a mount point you want to use as your ftp anonymous root:
mkdir /var/ftp
chown root:root /var/ftp
mkdir /var/ftp/pub
chown ftp:ftp /var/ftp/pub

Open in new window


Notice /var/ftp is owned by root:root, and therefore cannot be written to by vsftpd.  This is a requirement of vsftpd for a ROOT anonymous directory, that the anonymous root directory not be writable. So, /var/ftp is what I'm going to use as the anonymous root directory.
But /var/ftp/pub is writeable by vsftpd.  It appears to anonymous users as a "pub" directory on the FTP site where they can write files.

So add this line to /etc/fstab, which will point /var/ftp/pub (the anonymous writable directory) to the /ftp folder on my NTFS volume:
/mnt/Store01/ftp    /var/ftp/pub    auto    bind 0 0

Open in new window


And finally, in /etc/vsftpd/vsftpd.conf, this line:
anon_root=/var/ftp

Open in new window


Now an anonymous user can upload into the "pub" directory, on the anonymous FTP site.  Files uploaded there will appear in /ftp on my NTFS volume.
1
Comment
Author:Carman23
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 7

Expert Comment

by:MHenry
Hi Carman23,

I'm a Page Editor for EE and I'll be helping you get your article published. I'll look through it shortly. Just wanted to let you know it's in the process.

And sorry for the delay.

Best,
MH

0
 
LVL 2

Author Comment

by:Carman23
Oh yes, thanks for doing that.
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Join & Write a Comment

If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month