参考网站:
https://zhidao.baidu.com/question/175795731.html (问题553)
http://yuanbin.blog.51cto.com/363003/108262/ (配置文件)
vsftpd的配置与使用
-
ftp服务端配置
-
安装
-
sudo yum install vsftpd
-
-
vsftpd配置文件
-
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
-
文件夹权限
-
$sudo mkdir /var/ftp/upload
-
$sudo chmod -R 777 /var/ftp/upload
-
出现问题553 could not create file,不要修改文件的所有者和分组
-
#sudo chown haoyou upload
-
#sudo chgro root upload
-
全局系统配置
1.设置selinux
-
vi /etc/sysconfig/selinux
将其中的SELINUX=enforcing改为SELINUX=disabled
2. 查看ftpd_disable_trans ftp_home_dir allow_ftpd_full_access 是否为on。
-
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. 如果不是则使用
-
setsebool allow_sftpd_full_access on
-
#setsebool ftpd_disable_trans on
-
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
-
问题:匿名用户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用户也有权限。
-
Sudo vi /etc/vsftpd/vsftpd.conf
-
anon_umask=000
-
ftp客户端使用
-
连接
-
>ftp 10.67.0.81
-
OR ftp>open 10.67.0.81
-
User (10.67.0.81:(none)): ftp
-
Password:空
-
-
目录查看
-
ls
-
dir
-
!ls
-
!dir
-
cd mkdir rename …
-
lcd
-
-
上传下载
-
put ***
-
mput *.txt
-
get ***
-
mget *.txt
-