配置源的一些问题。[Errno 14] FTP Error 550 - Server denied you to change to the given directoryA

概要

在挂载ftp时出现的问题排查。

环境

在docker 中想使用私有云上本地源搭建私有的yum仓库。

报错内容

[root@ljs ~]# yum install httpd-tools -y
已加载插件:langpacks
Repository ftp is listed more than once in the configuration
base                                                                                                                                | 3.6 kB  00:00:00     
docker-ce-stable                                                                                                                    | 3.5 kB  00:00:00     
epel                                                                                                                                | 4.7 kB  00:00:00     
extras                                                                                                                              | 2.9 kB  00:00:00     
ftp://192.168.40.135/c6.9/repodata/repomd.xml: [Errno 14] FTP Error 550 - Server denied you to change to the given directory
正在尝试其它镜像。


 One of the configured repositories failed (ftpbase),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).

     3. Run the command with the repository temporarily disabled
            yum --disablerepo=ftp ...

     4. Disable the repository permanently, so yum won't use it by default. Yum
        will then just ignore the repository until you permanently enable it
        again or use --enablerepo for temporary usage:

            yum-config-manager --disable ftp
        or
            subscription-manager repos --disable=ftp

     5. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=ftp.skip_if_unavailable=true

failure: repodata/repomd.xml from ftp: [Errno 256] No more mirrors to try.
ftp://192.168.40.135/c6.9/repodata/repomd.xml: [Errno 14] FTP Error 550 - Server denied you to change to the given directory

尝试排错

  1. 排错 ftp是否启动
[root@ljs ~]# systemctl status vsftpd
● vsftpd.service - Vsftpd ftp daemon
   Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; enabled; vendor preset: disabled)
   Active: active (running) since 四 2023-10-05 14:56:13 CST; 30min ago
  Process: 1092 ExecStart=/usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf (code=exited, status=0/SUCCESS)
 Main PID: 1097 (vsftpd)
    Tasks: 1
   Memory: 760.0K
   CGroup: /system.slice/vsftpd.service
           └─1097 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf

10月 05 14:56:13 ljs systemd[1]: Starting Vsftpd ftp daemon...
10月 05 14:56:13 ljs systemd[1]: Started Vsftpd ftp daemon.

没有问题正在运行的active (running)

  1. 排错 确认配置文件/etc/yum.repos.d/ftp_centos6.repo
[ftp_c6]
name=myftp-c6
baseurl=ftp://192.168.40.135/centos6.9
enabled=1
gpgcheck=0

没问题

3 排查 是否挂载了内容

[root@ljs ~]# lftp 192.168.40.135
lftp 192.168.40.135:~> ls
drwxr-xr-x    2 0        0               6 Oct 04 00:01 c6.9
drwxr-xr-x    2 0        0               6 Oct 04 00:01 c7.5
drwxr-xr-x    2 0        0               6 Jun 09  2021 pub
lftp 192.168.40.135:/> cd c6.9/
lftp 192.168.40.135:/c6.9> ls

这里发现挂载了目录内容却未能找到
那么根据此问题迎刃而解是重机后自动销毁了。

解:再次挂载

格式:
mount -o loop <挂载的路径内容> <ftp路径>
mount -o loop /mnt/CentOS-6.9-x86_64-bin-DVD1.iso /var/ftp/c6.9/
**解2:(*可选不执行---跳过此步骤*)	实现开机自动挂载的命令**
vim /etc/fstab
#加到末尾
/mnt/CentOS-6.9-x86_64-bin-DVD1.iso /var/ftp/c6.9 iso9660 loop 0 0

若此时还是无法显示内容

[root@ljs ~]# lftp 192.168.40.135
lftp 192.168.40.135:~> ls /c6.9/

排查4) selinux访问控制mac机制

4.1 配置文件/etc/sysconfig/selinux

[root@ljs /]#cat /etc/sysconfig/selinux

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
#SELINUX=disabled
SELINUX=enforcing
# SELINUXTYPE= can take one of three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted 

说明下内容
SELINUX=enforcing
这个参数是拒绝不明确授权的操作
修改参数即可

SELINUX=disabled

重启系统

reboot

略:
#修改后重启系统或者 你只是做临时修改 那么在执行 可忽略

setenforce 0 

略:
说个笑话:这模式 SELINUX=permissive 设置此模式只打印错误(这妞有问题),不拒绝操作的模式(关灯一个样)。

4.2 如yum还是报错试试这个

使用适当的工具打开 SELinux 策略管理器

[root@ljs /]#semanage boolean -l | grep ftp
ftpd_use_cifs                  (关    ,    关)  Allow ftpd to use cifs
ftpd_connect_db                (关    ,    关)  Allow ftpd to connect db
ftpd_use_fusefs                (关    ,    关)  Allow ftpd to use fusefs
ftpd_full_access               (关    ,    关)  Allow ftpd to full access
tftp_anon_write                (关    ,    关)  Allow tftp to anon write
tftp_home_dir                  (关    ,    关)  Allow tftp to home dir
httpd_can_connect_ftp          (关    ,    关)  Allow httpd to can connect ftp
ftpd_use_passive_mode          (关    ,    关)  Allow ftpd to use passive mode
ftpd_use_nfs                   (关    ,    关)  Allow ftpd to use nfs
ftpd_connect_all_unreserved    (关    ,    关)  Allow ftpd to connect all unreserved
ftpd_anon_write                (关    ,    关)  Allow ftpd to anon write
httpd_enable_ftp_server        (关    ,    关)  Allow httpd to enable ftp server

执行一下内容

[root@ljs /]#setsebool -P ftpd_use_passive_mode 1
[root@ljs /]#setsebool -P ftpd_use_nfs 1
[root@ljs /]#setsebool -P httpd_can_connect_ftp 1

然后重新挂载ftp

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值