vsftpd的配置与使用

参考网站:

https://zhidao.baidu.com/question/175795731.html (问题553)

http://yuanbin.blog.51cto.com/363003/108262/ (配置文件)

vsftpd的配置与使用

  1. ftp服务端配置
  2. 安装
    1. sudo yum install vsftpd
  3. vsftpd配置文件
    1. sudo vi /etc/vsftpd/vsftpd.conf

write_enable=YES

anonymous_enable=YES

anon_upload_enable=YES

anon_mkdir_write_enable=YES

anon_other_write_enable=YES

  1. 文件夹权限
    1. $sudo mkdir /var/ftp/upload
    2. $sudo chmod -R 777 /var/ftp/upload

出现问题553 could not create file,不要修改文件的所有者和分组

  1. #sudo chown haoyou upload
  2. #sudo chgro root upload
  1. 全局系统配置

1.设置selinux

  1. vi /etc/sysconfig/selinux

将其中的SELINUX=enforcing改为SELINUX=disabled

2. 查看ftpd_disable_trans ftp_home_dir allow_ftpd_full_access 是否为on

  1. getsebool -a|grep ftp

allow_ftpd_anon_write --> off

allow_ftpd_full_access --> off

allow_ftpd_use_cifs --> off

allow_ftpd_use_nfs --> off

ftp_home_dir --> off

ftpd_connect_db --> off

httpd_enable_ftp_server --> off

tftp_anon_write --> off

3. 如果不是则使用

  1. setsebool allow_sftpd_full_access on
  2. #setsebool ftpd_disable_trans on
  3. setsebool ftp_home_dir on

allow_ftpd_anon_write --> off

allow_ftpd_full_access --> on

allow_ftpd_use_cifs --> off

allow_ftpd_use_nfs --> off

ftp_home_dir --> off

ftpd_connect_db --> off

httpd_enable_ftp_server --> off

tftp_anon_write --> off

  1. 问题:匿名用户ftp和anonymous上传下载问题

anonymous用户上传的文件,ftp用户不能下载

文件上传掩码的问题。

默认为anon_umask=077,上传后文件权限为-rwx------,同组其他用户没有权限。

-rwxrwxrwx 1 14 50 7931279360 Dec 19 08:53 R2016a_glnxa64.iso

drwx------ 2 14 50 4096 Dec 19 10:11 crack

-rwxrwxrwx 1 14 50 66910156 Dec 19 03:06 cudnn-7.0-linux-x64-v3.0.8-prod.solitairetheme8

-rw------- 1 14 50 36 Dec 19 09:52 testftp.txt

-rwxrwxrwx 1 14 50 36 Dec 19 09:48 testftp2.txt

-rw------- 1 14 50 36 Dec 19 09:53 testftp3.txt

修改配置文件中anon_umask=000,则上传文件后权限为-rwxrwxrwx,同组ftp用户也有权限。

  1. Sudo vi /etc/vsftpd/vsftpd.conf
  2. anon_umask=000
  1. ftp客户端使用
  2. 连接
    1. OR ftp>open 10.67.0.81
    2. User (10.67.0.81:(none)): ftp
    3. Password:
  3. 目录查看
    1. ls
    2. dir
    3. !ls
    4. !dir
    5. cd mkdir rename …
    6. lcd
  4. 上传下载
    1. put ***
    2. mput *.txt
    3. get ***
    4. mget *.txt
原文地址:https://www.cnblogs.com/yizhichun/p/6395344.html