Saturday, December 8, 2012

Sharing a folder Fedora 16 via FTP

Today I was trying to share a very large folder ftp. One Idea was to copy the complete folder to /var/ftp, but this is a bad way when Linux kernel supports mounting a directory from multiple locations.

1. Installing FTP server
    On fedora its as simple as yum install vsftpd
2. Start the service
    service vsftpd start
3. Adding this to startup
    chkconfig vsftpd on
4. Mounting the directory using
    mount --bind [directory to mount] [directory in which it would be mounted]
As I was trying to mount sdb drives to the specified folders, I was unable to open them via ftp although they were working fine using nautilus. I googled then I found a solution of setting SELinux to Permissive mode using setenforce 0

Since mounting operation needs to be done after every boot, I made a simple text file:

mount --bind /media/H/ /var/ftp/Shared
mount --bind /media/I/ /var/ftp/Another

setenforce 0
A snapshot of the same
Deep inside directory tree

2 comments:

  1. to permanently set SELinux to permissive mode, and not doing a [setenforce 0] everytime, you can open up [/etc/selinux/config] in root mode and change

    SELINUX=enforcing
    to
    SELINUX=permissive

    otherwise for every boot up you will have to run the script

    ReplyDelete
  2. It can also be achieved by changing the file /etc/fstab with proper flags

    ReplyDelete