Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am having problems to allow anonymous FTP access to a directory that mounted a ISO file.

  • No change to /etc/vsftpd/vsftpd.conf
  • RHEL 6.5 DVD ISO file saved to /var/ftp/pub/ISO/rhel6_5.iso
  • Anonymous user can see this ISO file
  • Created a directory /var/ftp/pub/rhel
  • Mounted iso file, mount -o loop,ro /var/ftp/pub/ISO/rhel6_5.iso /var/ftp/pub/rhel

But anonymous ftp users can't see rhel directory for some reason, any ideas ?

I followed this instructions vsftpd symbolic link, but it did not work for me. /var/ftp/pub/rhel directory will disappear from anonymous FTP user, if I mount the ISO file.

Here is ls -lZ output. I also noticed that SELinux context will change once I mount the ISO file.

[root@citest pub]# ls -lZ
drwxr-xr-x. root root unconfined_u:object_r:public_content_t:s0 ISO
drwxr-xr-x. root root unconfined_u:object_r:public_content_t:s0 rhel
share|improve this question
What permission have the /var/ftp/pub/rhel directory? – Braiam Jul 3 '14 at 2:27

After about 3 hours, I think I figured out why it is not working.

Selinux context public_content_t is required for files shared via an FTP server, unless associated with a user home directory and looks like /var/ftp/pub does not qualify for home directory.

After I mounted ISO file, the security context of rhel changed to system_u:object_r:iso9660_t:s0 and also because ISO file can only be mounted as read only, I could not change security context.

Also noticed following in /var/log/audit/audit.log

type=AVC msg=audit(1404397698.292:182): avc:  denied  { getattr } for  pid=2671 comm="vsftpd" path="/pub/ISO/rhel" dev=loop1 ino=1856 scontext=unconfined_u:system_r:ftpd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:iso9660_t:s0 tclass=dir

Disabled selinux and restarted vsftpd, all working fine.

share|improve this answer

I have a VM that has connected a iso image as virtual cdrom, that's almost the same as your setup.

I added this line to /etc/fstab

/dev/cdrom /repo iso9660 rootcontext=system_u:object_r:public_content_t:s0,context=system_u:object_r:public_content_t:s0 0 0

Search in mount(8) for selinux options

ftp user setup:

# getent passwd ftp
ftp:x:14:50:FTP User:/repo:/sbin/nologin
share|improve this answer
At night, all cats are gray, and, to a VM, a virtual CD is the same as a real CD.  (I assume that you're talking about an ISO image file on the host.)  I doubt that this is "almost the same" as loopback-mounting a local ISO file. – G-Man Oct 2 '15 at 20:13
Let's kill that cat. On the host: mount -o loop,rootcontext=system_u:object_r:public_content_t:s0,context=system_u:object_r‌​:public_content_t:s0 ./CentOS-7-x86_64-DVD-1503-01.iso /repo – Kolja Oct 2 '15 at 20:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.