linux文件传输-开启ftp的21端口
2016-07-30 20:20
351 查看
1、先运行vsftpd服务:
2、通过iptables开放21号端口
(1) 先查看iptables设置:
(2) 将21号端口插入到INPUT的ACCEPT中
(3)插入到INPUT的ACCEPT后查看
3、 在客户端上telnet ip 21,验证
关键点:一定要将插入的规则放在REJECT all – 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited 之前,否则不会起作用!!
!!重启vsftpd服务
% service vsftpd start
2、通过iptables开放21号端口
(1) 先查看iptables设置:
% iptables -nL
Chain INPUT (policy ACCEPT) target prot opt source destination ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited //如果不满足以上规则,则统统reject; Chain FORWARD (policy ACCEPT) target prot opt source destination REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited Chain OUTPUT (policy ACCEPT) target prot opt source destination
(2) 将21号端口插入到INPUT的ACCEPT中
% iptables -I INPUT 5 -p tcp --dport 21 -j ACCEPT ## rulenum为5 ,在INPUT中REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited之前
(3)插入到INPUT的ACCEPT后查看
% iptables -nL --line-numbers
Chain INPUT (policy ACCEPT) num target prot opt source destination 1 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED 2 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 3 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 4 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22 5 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:21 6 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited Chain FORWARD (policy ACCEPT) num target prot opt source destination 1 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited Chain OUTPUT (policy ACCEPT) num target prot opt source destination
3、 在客户端上telnet ip 21,验证
关键点:一定要将插入的规则放在REJECT all – 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited 之前,否则不会起作用!!
解决ftp上传失败问题:vsftpd默认是不可写的,需要修改配置文件
% vim /etc/vsftpd.conf write_eable = YES
!!重启vsftpd服务
/etc/init.d/vsftpd restart 或者 service vsftpd restart
相关文章推荐
- Linux socket 初步
- Linux Kernel 4.0 RC5 发布!
- linux lsof详解
- linux 文件权限
- Linux 执行数学运算
- 10 篇对初学者和专家都有用的 Linux 命令教程
- Linux 与 Windows 对UNICODE 的处理方式
- Ubuntu12.04下QQ完美走起啊!走起啊!有木有啊!
- 解決Linux下Android开发真机调试设备不被识别问题
- 运维入门
- 运维提升
- Linux 自检和 SystemTap
- Ubuntu Linux使用体验
- c语言实现hashmap(转载)
- Linux 信号signal处理机制
- linux下mysql添加用户
- Scientific Linux 5.5 图形安装教程
- Linux 下无损图片压缩小工具介绍