1. 日志查询

     /var/log/xferlog 

#####以下都是在ftp服务端更改:

2. 500 OOPS 报错:

    [root@semptian-6 rpm]# ftp 192.168.40.131

    Connected to 192.168.40.131 (192.168.40.131).

    220 (vsFTPd 2.2.2)

    Name (192.168.40.131:root): test

    331 Please specify the password.

    Password:

    500 OOPS: cannot change directory:/home/test



   解决方法:

   a. 运行以下命令:

   [root@semptian-6 rpm]# setsebool ftpd_disable_trans 1

   Could not change active booleans: Invalid boolean

   [root@semptian-6 rpm]# getsebool ftpd_disable_trans

   Error getting active value for ftpd_disable_trans

   b. 运行 a 命令不能解决,运行以下命令:

   [root@semptian-6 rpm]# setsebool ftp_home_dir=1 

   [root@semptian-6 rpm]# 

   [root@semptian-6 rpm]# service vsftpd restart



参考:

cannot change directory:/home/***


ftp服务器连接失败,错误提示:


500 OOPS: cannot change directory:/home/*******


500 OOPS: child died


解决方法:


在终端输入命令:


setsebool ftpd_disable_trans 1


service vsftpd restart


就行了。




登陆ftp时再输入用户名和密码出现:500 OOPS: cannot change directory:/home/**********


解决方法:在终端输入 setsebool ftpd_disable_trans 1 然后重启vsftp服务 service vsftpd restart 如果输入上述命令时出现:Could not change active booleans: Invalid boolean 是因为SELinux的问题接着在终端输入:setsebool ftp_home_dir=1 重启vsftp服务即可解决问题



3. 530 Permission denied。

故障排除:

1.首先检查系统是否开启了vsftp服务,如果没有开启,先开启该服务。

方法1.setup--系统服务--自启动服务

方法2.界面设置,service vsftpd restart

2.查看配置

vsftpd的配置,配置文件中限定了vsftpd用户连接控制配置。

vsftpd.ftpusers:位于/etc目录下。它指定了哪些用户账户不能访问FTP服务器,例如root等。

vsftpd.user_list:位于/etc目录下。该文件里的用户账户在默认情况下也不能访问FTP服务器,仅当vsftpd .conf配置文件里启用userlist_enable=NO选项时才允许访问。

vsftpd.conf:位于/etc/vsftpd目录下。来自定义用户登录控制、用户权限控制、超时设置、服务器功能选项、服务器性能选项、服务器响应消息等FTP服务器的配置。

3.配置修改完成后,执行service vsftpd restart重启vsftpd服务。



4.  vsftp关于"550 create directory operation failed"问题解决 

vsftpd正常设置

但登陆后不能创建,也不能删除提示550错误

解决办法可以关掉selinux=disable

[root@host]# vi /etc/selinux/config

----------------------------------------------------------------------------------

# 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 - SELinux is fully disabled.

SELINUX=disabled

#把这里改成disabled

# SELINUXTYPE= type of policy in use. Possible values are:

#       targeted - Only targeted network daemons are protected.

#       strict - Full SELinux protection.

SELINUXTYPE=targeted 


 -----------------------------------------------------------------------------------

 

如果在想不重启系统的情况下关掉SELINUX,可以输入命令:

setenforce 0 



 -----------------------------------------------------------------------------------


目的是:在linux系统上建立ftp用户,并限制其通过ftp访问时,只能访问用户主目录;其主目录显示路径也是“/”,看不到上级目录。

 

 

例如,我要建立用户usertest,密码为usertest,主目录为/home/mpsp/ftp/usertest

操作系统:Red Hat Enterprise Linux Server release 5.4 (Tikanga)

ftp:vsftp

 

首先,建立linux系统用户usertest:

1、以mpsp用户登陆系统,建立usertest的主目录/home/mpsp/ftp/usertest

2、以root用户登录linux系统,建立带有主目录的用户,输入命令:

                      [root@- home]# useradd -d /home/mpsp/ftp/usertest usertest

 

3、 为用户分配密码,输入命令:

                      [root@- etc]# passwd usertest

                      Changing password for user usertest.

                      New UNIX password:

                      Retype new UNIX password:

                      passwd: all authentication tokens updated successfully.

 

此时查看:[root@- etc]# cat /etc/passwd

可看到用户配置是这样的:usertest:x:504:504::/home/mpsp/ftp/usertest:/bin/bash

系统为用户分配了新的用户id和组id:504、504。由于该用户的所有文件需对mpsp用户开放访问权限,我们可以将usertest分配到mpsp组(组id500)。

 

    4、为用户分配新的用户组,输入命令:

                      [root@- home]# usermod -g mpsp usertest

             

此时查看:[root@- etc]# cat /etc/passwd

可看到用户配置是这样的:usertest:x:504:500::/home/mpsp/ftp/usertest:/bin/bash

 

然后,配置用户ftp权限及访问路径限制:

此时用usertest登陆系统ftp,是否可以访问?如果无法访问,说明我们的ftp做了限制。打开/etc/vsftpd/vsftpd.conf,查找userlist_enable、userlist_deny、userlist_file。如果userlist_deny=NO:只允许userlist_file文件中的用户可访问ftp;如果userlist_deny=YES:userlist_file文件中列举的用户不能通过ftp访问系统。userlist_enable是该功能的开关。我们的系统配置如下:

        userlist_enable=YES

  userlist_deny=NO

  userlist_file=/etc/vsftpd/user_list

    所以需要把用户加入到/etc/vsftpd/user_list文件中,每个用户一行。

 

      由于该主目录是mpsp用户建的,usertest是mpsp组的成员,所以usertest默认具有增删查改权限;而usertest作为mpsp组成员,对/home/mpsp下的所有路径具有访问权限(根据各目录的权限设置,默认是这样),登录ftp后会发现,usertest用户可以访问其他目录,并且具有mpsp组的权限,这样做是不允许的,我们需要将usertest用户的访问范围控制在其主目录下。方法如下:

      1. cd /etc/vsftpd 进入ftp配置文件目录

      2. vi vsftpd.conf编辑此文件,找到#chroot_list_enable=YES,删除前面的那个#号,表示开启此限制功能

          找到chroot_list_file:chroot_list_file=/etc/vsftpd/chroot_list

      3. 编辑chroot_list文件,加入你要限制的用户名,一行一个用户.

 

      如果更新了vsftpd.conf,一定要重启ftp,命令如下:

      [root@linuxsir001 root]# /etc/init.d/vsftpd restart

      关闭 vsftpd: [ 确定 ]

      为 vsftpd 启动 vsftpd: [ 确定 ]

 

      再用usertest通过ftp访问系统,用户成功登陆,并且成功的被限制在自己的主目录下,无法访问其他目录。大功告成。

  



5.[root@localhost logsender]# ftp 192.168.1.123

>ftp: connect: 没有到主机的路由

关闭 192.168.1.123 的 iptables




http://blog.chinaunix.net/uid-28476-id-2134671.html



/etc/vsftpd/vsftpd.conf

Idle_session_timeout=600(秒) (用户会话空闲后10分钟)

  Data_connection_timeout=120(秒) (将数据连接空闲2分钟断)

  Accept_timeout=60(秒) (将客户端空闲1分钟后断)

  Connect_timeout=60(秒) (中断1分钟后又重新连接)

  Local_max_rate=50000(bite) (本地用户传输率50K)

  Anon_max_rate=30000(bite) (匿名用户传输率30K)

  Pasv_min_port=50000 (将客户端的数据连接端口改在

  Pasv_max_port=60000 50000—60000之间)

  Max_clients=200 (FTP的最大连接数)

  Max_per_ip=4 (每IP的最大连接数)  ---- 返回 421 错误可更改此值

  Listen_port=5555 (从5555端口进行数据连接)