小米路由器mini建FTP
输入命令
- df -h
查看自己的分区路径,我自己用了一个闲置笔记本电脑硬盘转USB,插到mini,有四个区
为了方便,我选择把ftp安装在第一个分区 /extdisks/sda1/
创建ftp的安装目录,输入:
- mkdir -m 0777 -p /extdisks/sda1/ftp
(嫌麻烦的童鞋可以用winscp工具按照路径制作)
然后备份一下/etc/opkg.conf,输入:
- cp /etc/opkg.conf /etc/opkg.conf-backup
编辑/etc/opkg.conf,输入:
- vi /etc/opkg.conf
点一下 i 编辑,把里面的内容删除干净,然后粘贴以下内容,路径里面的x请修改成你自己的ftp目录文件名:
src/gz barrier_breaker_base http://downloads.openwrt.org/barrier_breaker/14.07/ramips/mt7620a/packages/base
src/gz barrier_breaker_luci http://downloads.openwrt.org/barrier_breaker/14.07/ramips/mt7620a/packages/luci
src/gz barrier_breaker_packages http://downloads.openwrt.org/barrier_breaker/14.07/ramips/mt7620a/packages/packages
src/gz barrier_breaker_routing http://downloads.openwrt.org/barrier_breaker/14.07/ramips/mt7620a/packages/routing
src/gz barrier_breaker_telephony http://downloads.openwrt.org/barrier_breaker/14.07/ramips/mt7620a/packages/telephony
src/gz barrier_breaker_management http://downloads.openwrt.org/barrier_breaker/14.07/ramips/mt7620a/packages/management
src/gz barrier_breaker_oldpackages http://downloads.openwrt.org/barrier_breaker/14.07/ramips/mt7620a/packages/oldpackages
dest root /extdisks/sda1/x
dest ram /tmp
lists_dir ext /extdisks/sda1/x/opkg-lists
option overlay_root /extdisks/sda1/x
dest usb /extdisks/sda1/x
保存请按一下 ESC键,然后按一下 : 键(shift+;),然后输入 wq 回车。
验证是否成功,输入:
- opkg update
成功结果会显示以下内容:
Downloading http://downloads.openwrt.org/barrier_breaker/14.07/ramips/mt7620a/packages/base/Packages.gz.
Updated list of available packages in /extdisks/sda1/x/opkg-lists/barrier_breaker_base.
Downloading http://downloads.openwrt.org/barrier_breaker/14.07/ramips/mt7620a/packages/luci/Packages.gz.
Updated list of available packages in /extdisks/sda1/x/opkg-lists/barrier_breaker_luci.
Downloading http://downloads.openwrt.org/barrier_breaker/14.07/ramips/mt7620a/packages/packages/Packages.gz.
Updated list of available packages in /extdisks/sda1/x/opkg-lists/barrier_breaker_packages.
Downloading http://downloads.openwrt.org/barrier_breaker/14.07/ramips/mt7620a/packages/routing/Packages.gz.
Updated list of available packages in /extdisks/sda1/x/opkg-lists/barrier_breaker_routing.
Downloading http://downloads.openwrt.org/barrier_breaker/14.07/ramips/mt7620a/packages/telephony/Packages.gz.
Updated list of available packages in /extdisks/sda1/x/opkg-lists/barrier_breaker_telephony.
Downloading http://downloads.openwrt.org/barrier_breaker/14.07/ramips/mt7620a/packages/management/Packages.gz.
Updated list of available packages in /extdisks/sda1/x/opkg-lists/barrier_breaker_management.
Downloading http://downloads.openwrt.org/barrier_breaker/14.07/ramips/mt7620a/packages/oldpackages/Packages.gz.
Updated list of available packages in /extdisks/sda1/x/opkg-lists/barrier_breaker_oldpackages.
开始安装ftp,按顺序分别输入下面这几个命令:
- cd /extdisks/sda1/x/
- wget http://downloads.openwrt.org/barrier_breaker/14.07/ramips/mt7620a/packages/base/libc_0.9.33.2-1_ramips_24kec.ipk
- opkg -d usb install libc_0.9.33.2-1_ramips_24kec.ipk
- opkg -d usb install vsftpd
到这里ftp基本安装完毕,但是还需要设置一下
输入: vi /extdisks/sda1/x/etc/init.d/vsftpd
删除旧的内容,加入下面的内容
- #!/bin/sh /etc/rc.common
- # Copyright (C) 2006-2011 OpenWrt.org
- START=50
- start() {
- mkdir -m 0755 -p /var/run/vsftpd
- service_start /extdisks/sda1/x/usr/sbin/vsftpd
- }
- stop() {
- service_stop /extdisks/sda1/x/usr/sbin/vsftpd
- }
保存退出
然后输入:
- vi /etc/vsftpd.conf
复制以下内容到里面,提供两个版本供大家选其一,简单版和严格版。
简单版,易用,即设即用,不过安全性较低。
background=YES
listen=YES
listen_port=21
anonymous_enable=YES
anon_upload_enable=YES
anon_mkdir_write_enable=YES
idle_session_timeout=300
max_clients=5
max_per_ip=5
local_enable=YES
write_enable=YES
local_umask=022
check_shell=NO
anon_root=/extdisks/sda1/
local_root=/extdisks/sda1/
ftp_username=nobody
#dirmessage_enable=YES
#ftpd_banner=Welcome to blah FTP service.
session_support=NO
#syslog_enable=YES
#userlist_enable=YES
#userlist_deny=NO
#userlist_file=/extdisks/sda1/x/etc/vsftpd.users
#xferlog_enable=YES
#xferlog_file=/var/log/vsftpd.log
#xferlog_std_format=YES
chown_uploads=YES
chown_username=root
安全严格版,不懂请百度以下参数,配合/etc/passwd 设置用户权限,安全系数增大。
background=YES
listen_port=21
anonymous_enable=NO #匿名用户登录,默认不开启
anon_upload_enable=YES
anon_mkdir_write_enable=YES
idle_session_timeout=300
max_clients=5
max_per_ip=5
local_enable=YES #本地用户登录开启,也就可以用root等用户登录
write_enable=YES
file_open_mode=0777
local_umask=022
check_shell=NO
anon_root=/extdisks/sdax/x/ #匿名用户访问的目录
local_root=/extdisks/sdax/x/ #本地用户访问的目录
chown_uploads=YES
chown_username=ftp
ftp_username=ftp
#dirmessage_enable=YES
#ftpd_banner=Welcome to blah FTP service.
session_support=NO
#syslog_enable=YES
userlist_enable=YES
userlist_deny=NO
userlist_file=/etc/vsftpd/user_list1 #自己按需要创建文件,加入用户root,这样root才能登录,一行一个用户
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/user_list2 #自己按需要创建文件,加入用户root,这样root才能登录,一行一个用户
#xferlog_enable=YES
#xferlog_file=/var/log/vsftpd.log
#xferlog_std_format=YES
allow_writeable_chroot=YES
保存按ESC ,然后按 : 一下,输入wq 保存。
开启ftp,输入:
- /extdisks/sda1/x/etc/init.d/vsftpd start
没有显示的话,一般情况下都成功。
验证ftp是否成功,在资源管理器输入:
ftp://路由器IP
因为安全策略的关系,会弹出你没有权限的窗口,不用担心,在画面右击登录,用root登录即可。
- vi /etc/init.d/usb_deploy_init_script.sh
mkdir -p /tmp/xiaomi_router
在下面加入一行命令
- /extdisks/sda1/x/etc/init.d/vsftpd start
- vi /etc/config/firewall
保存退出。
重启防火墙生效,输入:
- /etc/init.d/firewall restart
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。