OpenWrt Forum Archive

Topic: When I upload data to FTP, data is writen to flash instead of MMC

The content of this topic has been archived on 27 Mar 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi,
I have WRT54GL with 16MB ram and 4MB of flash + with SD/MMC mod & 1GB MMC card.
With EXT3 partition and folder ftp in it, and mounted to /sdcard folder.

I have installed vsftpd server and added 3 users to to system which I'm using to log in to FTP.
I can upload data to ftp and download it, but there is a problem.
I have 600kb free of space on flash chip.
But If I upload 10MB data to ftp I successfully upload and save file to FTP, and I also can download file from FTP - so this is working fine.
But if I look at flash I see that I have only 2kB left of space on flash. And if I delete file from FTP I again have 600kB of free space on flash.

Why is OpenWRT saving data first on flash drive and then on sd card. How to force ftp to only save files from FTP to sd card.
I have saved file to /sdcard/ftp/test folder. So it should be saved on MMC and not on Flash.

Also I have another bug with ftp, users have set startup directory /sdcard/ftp/test and they start in this dir but they can go up to / dir.
How to disable that, so they can go only lower than /sdcard/ftp/test but not higher (like /sdcard/ftp )

I think it would be helpful, if you show us the vsftpd config files.

vi /etc/vsftpd.conf
background=YES
listen=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
check_shell=NO
#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.users
#xferlog_enable=YES
#xferlog_file=/var/log/vsftpd.log
#xferlog_std_format=YES
force_dot_files=YES
hide_ids=YES
max_per_ip=2
max_clients=10
pasv_min_port=12000
pasv_max_port=12100
vi /etc/vsftpd.users
worm
temp
vi /etc/passwd
root:<removed>:0:0:root:/root:/bin/ash
nobody:*:65534:65534:nobody:/var:/bin/false
daemon:*:65534:65534:daemon:/var:/bin/false
worm:<removed>:8888:65534:worm:/sdcard/ftp/worm:/bin/false
temp:<removed>:8890:65534:temp:/sdcard/ftp/temp:/bin/false

I have removed password and paste this tag instead <removed>, in forum post.

root@OpenWrt:~# fdisk -l

Disk /dev/sdcard/disc: 988 MB, 988282880 bytes
255 heads, 63 sectors/track, 120 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x919e849f

           Device Boot      Start         End      Blocks   Id  System
/dev/sdcard/part1               1         120      963868+  83  Linux
root@OpenWrt:~# ls -l /sdcard/
drwxrwxrwx    1 root     root            0 Sep 24  2017 ftp
drwxr-xr-x    1 root     root            0 Sep 24  2017 jffs
root@OpenWrt:~# ls -l /sdcard/ftp
drwxrwxrwx    1 root     root            0 Sep 24  2017 worm
drwxrwxrwx    1 root     root            0 Sep 24  2017 temp

I had added value

chroot_local_user=YES

to the end of /etc/vsftpd.conf file and restarted server, and this disabled users to browse whole system but they can only be in thers folder.

My system still first writes data to Flash chip and only if chip is full, data is writen to MMC.

The discussion might have continued from here.