1.配置匿名访问模式,重新启动服务,把服务程序加入到开机启动项中。
vsftpd服务程序默认关闭了匿名开放模式,需要做的就是开放匿名用户的上传、下载文件的权限,以及让匿名用户创建、删除、更名文件的权限。
向匿名用户开放的权限参数以及作用
anonymous_enable=YES:允许匿名访问模式
anon_umask=022:匿名用户上传文件的umask 值
anon_upload_enable=YES:允许匿名用户上传文件
anon_mkdir_write_enable=YES:允许匿名用户创建目录
anon_other_write_enable=YES:允许匿名用户修改目录名称或删除目录
[root@dsrw ~]# vim /etc/vsftpd/vsftpd.conf
1 anonymous_enable=yes
2 anon_umask=022
3 anon_upload_enable=YES
4 anon_mkdir_write_enable=YES
5 anon_other_write_enable=YES
6 local_enable=YES
7 write_enable=YES
8 local_umask=022
9 dirmessage_enable=YES
10 xferlog_enable=YES
11 connect_from_port_20=YES
12 xferlog_std_format=YES
13 listen=NO
14 listen_ipv6=YES
15 pam_service_name=vsftpd
16 userlist_enable=YES
[root@dsrw ~]# systemctl restart vsftpd
[root@dsrw ~]# systemctl enable vsftpd
Created symlink /etc/systemd/system/multi-user.target.wants/vsftpd.service → /usr/lib/systemd/system/vsftpd.service.
2.linux客户机ftp登录服务器
[root@dsrw ~]# ftp 192.168.10.2
Connected to 192.168.10.2 (192.168.10.2).
220 (vsFTPd 3.0.3)
Name (192.168.10.2:root): anonymous
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
227 Entering Passive Mode (192,168,10,2,58,107).
ftp: connect: No route to host
ftp> cd pub
250 Directory successfully changed.
ftp> mkdir dsrw
550 Create directory operation failed.
3.在服务器上修改/var/ftp目录权限
[root@dsrw ~]# ls -ld /var/ftp/pub
drwxr-xr-x. 2 root root 6 8月 13 2018 /var/ftp/pub
[root@dsrw ~]# chown -R ftp /var/ftp/pub
[root@dsrw ~]# ls -ld /var/ftp/pub
drwxr-xr-x. 2 ftp root 6 8月 13 2018 /var/ftp/pub
4.SELinux域策略设置允许FTP
[root@dsrw ~]# setsebool -P ftpd_full_access=on
[root@dsrw ~]# getsebool -a|grep ftp
ftpd_anon_write --> off
ftpd_connect_all_unreserved --> off
ftpd_connect_db --> off
ftpd_full_access --> on
ftpd_use_cifs --> off
ftpd_use_fusefs --> off
ftpd_use_nfs --> off
ftpd_use_passive_mode --> off
httpd_can_connect_ftp --> off
httpd_enable_ftp_server --> off
tftp_anon_write --> off
tftp_home_dir --> off
5.linux客户机ftp再次登录服务器测试
[root@dsrw ~]# ftp 192.168.10.2
Connected to 192.168.10.2 (192.168.10.2).
220 (vsFTPd 3.0.3)
Name (192.168.10.2:root): anonymous
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> cd pub
250 Directory successfully changed.
ftp> mkdir dsrw
257 "/pub/dsrw" created
ftp> rmdir dsrw
250 Remove directory operation successful.
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
请登录后查看评论内容