0

I am trying to get a better understanding of selinux and configuring a local ftp repository on Centos7.

I installed vsftpd on my host.

I created a repository on my host:

/var/ftp/pub/centos7
  EFI
  EULA
  GPL
  images
  isolinux
  LiveOS
  Packages
  repodata
  RPM-GPG-KEY-CentOS-7
  RPM-GPG-KEY-CentOS-Testing-7
  TRANS.TBL

When I try to list my available repository I get an error on my guest vm:

# yum repolist
Loaded plugins: fastestmirror
ftp://X.X.X.X/pub/centos7/repodata/repomd.xml: [Errno] FTP Error 550 - Server denied you to change to the given directory
Trying other mirror/
ftp://X.X.X.X/pub/centos7/repodata/repomd.xml: [Errno] FTP Error 550 - Server denied you to change to the given directory
Trying other mirror/

repo id     repo name            status
local-repo  Centos7 Repository   0
repolist: 0

However if I setenforce 0 or setsebool ftpd_full_access 1 my repository works.

repo id     repo name            status
local-repo  Centos7 Repository   3,723
repolist: 3,723

Obviously leaving setenforce to 0 is not advised but is leaving setsebool ftpd_full_access set to 1 the correct way to configure a local ftp repository? What am asking is, is there a correct way to configure an ftp repository with selinux running?

If anyone can point me in the right direction it will be greatly appreciated.

  • I've configured vsftpd on CentOS 7 in the past, and from what I can tell the Boolean ftpd_full_access 1 is OK, also you have the # setsebool -P ftp_home_dir 1 option if you need it. This link might be helpful: tuxfixer.com/vsftpd-installation-on-centos-7-with-selinux – nomad.rc Jun 15 '16 at 2:25
  • What is the output of ls -Zd /var/ftp/pub/centos7/? Perhaps the labels are wrong? Or one of the parent directories? Does running restorecon -rv /var/ftp fix this issue? – jsbillings Jun 20 '16 at 0:20
0

I had the same issue. [ftp://192.168.122.1/repodata/repomd.xml: [Errno 14] FTP Error 550 - Server denied you to change to the given directory]

Initially thought its a permission or some sort of security issue but its not.

When i tried to download repomd.xml file from client machine using wget [wget ftp://192.168.122.1/repodata/repomd.xml] it said file not found.

In my case issue was, in configuration file /etc/vsftp.conf my repodata directory was are supposed to be /var/ftp (anon_root=/var/ftp/pub) but i had kept under /var/ftp/. It expects "repodata/repomd.xml" to be placed under "/var/ftp" according to the settings in vsftp.conf

Then I just moved my sub directories inside /var/ftp::

root@uday-linux:/var/ftp# pwd
/var/ftp
root@uday-linux:/var/ftp# ls
openstack-queens-rdo-repo
root@uday-linux:/var/ftp# ls openstack-queens-rdo-repo/
openstack-queens  rdo-qemu-ev  repodata  rhel-7-server-extras-rpms  rhel-7-server-optional-rpms  rhel-7-server-rh-common-rpms  rhel-7-server-rpms
root@uday-linux:/var/ftp# ls
openstack-queens-rdo-repo
root@uday-linux:/var/ftp# mv openstack-queens-rdo-repo/* .
root@uday-linux:/var/ftp# rmdir openstack-queens-rdo-repo
root@uday-linux:/var/ftp# ls
openstack-queens  rdo-qemu-ev  repodata  rhel-7-server-extras-rpms  rhel-7-server-optional-rpms  rhel-7-server-rh-common-rpms  rhel-7-server-rpms
root@uday-linux:/var/ftp# 
root@uday-linux:/var/ftp# 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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