PDA

Bekijk de volledige versie : stupid-ftp and filesystem on HDD



Vladimir
20-01-2005, 17:18
The troubles with stupid-ftp

I have ASUS wl-500b with the firmware v.1.9.2.7 CR3b from Oleg. I have following problems with th FTP server that is the part of the firmware:

1) while uploading file, it is saved with reset attributes and with "root" as the file owner, so the access to this file is denied for www server.
---------- 1 root root 758 Jan 18 00:01 test.html

2) In case I set the owner and the attributes for this file (666) and try to update it, the following happens: If the updated file is shorter then the original file, FTP server does not adjust the file size but just overwrites old file by new data, so the lenght of the file stays the same and there is still the rest of old data after the
new one. If new file is longer, there is no problem.

Is it possible that these two problems are caused by file system incompatibility? (The file system containing the FTP directory is formated as "ext3" instead of "FAT".)

3) The original "stupid-ftpd.conf" file got lost after the conversion of filesystem on my HDD and it can not be found. Was it been created dynamicaly? The command "find / -name stupid-ftpd.*" only finds the FTPD server. But I can still add and delete the users, set up bann to IP addresses etc. And these changes will stay stored on www pages even after router restart. But their influence to FTP server is none.
By the way, I found the way how to cheat it: I created the file stupid-ftp.conf in different directory (/usr/etc/) and I run the FTP server from script /usr/local/sbin/post-boot by the command /usr/sbin/stupid-ftpd -f /usr/etc/stupid-ftpd.conf.

4) If I login o the router using Telnet or SSH, FTP keep listing weird reports to console, such as "Unknown command: 'FEAT'" etc. (It looks like it is not only error messages.) Even adding "&>/dev/null" to the command I use to start the FTP daemon would not work.

Thank you for any advice or help!

My configuration:
--------------------------
ASUS wl-500b, firmware v.1.9.2.7 CR3b from Oleg, web server thttpd s PHP4

Filesystem is placed on HDD, HDD is divided into following partitions:
/dev/scsi/host0/bus0/target0/lun0/part1 * 1 497 2003872+ 83 Linux
/dev/scsi/host0/bus0/target0/lun0/part2 498 514 68544 82 Linux swap
/dev/scsi/host0/bus0/target0/lun0/part3 515 788 1104768 83 Linux

Partition 1 a partition 3 are formated as ext3 and mounted:
/dev/scsi/host0/bus0/target0/lun0/part1 on / type ext3 (rw)
/dev/scsi/host0/bus0/target0/lun0/part3 on /tmp/harddisk type ext3 (rw)

symbolic link ftp -> /tmp/harddisk does exist

Konfiguration file for stupid-ftpd looks like this:
mode=daemon
serverroot=/ftp
changeroottype=real
banmsg=You have no permission
log=/tmp/stupid-ftpd.log
port=21
maxusers=12
login-timeout=120
timeout=240
user=admin admin // 0 A
user=userpub passpub /ftp_pub/ 2 A
user=web passweb /ftp_pvt/web/ 2 A

Oleg
20-01-2005, 21:18
Vladimir, I will check on this shortly. Just need some time for other things.

Antiloop
21-01-2005, 09:20
The troubles with stupid-ftp

I have ASUS wl-500b with the firmware v.1.9.2.7 CR3b from Oleg. I have following problems with th FTP server that is the part of the firmware:

1) while uploading file, it is saved with reset attributes and with "root" as the file owner, so the access to this file is denied for www server.
---------- 1 root root 758 Jan 18 00:01 test.html

2) In case I set the owner and the attributes for this file (666) and try to update it, the following happens: If the updated file is shorter then the original file, FTP server does not adjust the file size but just overwrites old file by new data, so the lenght of the file stays the same and there is still the rest of old data after the
new one. If new file is longer, there is no problem.

Is it possible that these two problems are caused by file system incompatibility? (The file system containing the FTP directory is formated as "ext3" instead of "FAT".)

regarding case 2 I've also seen this happening with fat32 & stupid-ftpd

Oleg
22-01-2005, 13:47
1) while uploading file, it is saved with reset attributes and with "root" as the file owner, so the access to this file is denied for www server.
---------- 1 root root 758 Jan 18 00:01 test.html

Yes, this is a bug. Fixed.


2) In case I set the owner and the attributes for this file (666) and try to update it, the following happens: If the updated file is shorter then the original file, FTP server does not adjust the file size but just overwrites old file by new data, so the lenght of the file stays the same and there is still the rest of old data after the
new one. If new file is longer, there is no problem.

Bug, the in the same line as above, added truncation.


Is it possible that these two problems are caused by file system incompatibility? (The file system containing the FTP directory is formated as "ext3" instead of "FAT".)

Truncation thing should happen with FAT also, attributes - have not checked this yet.



3) The original "stupid-ftpd.conf" file got lost after the conversion of filesystem on my HDD and it can not be found. Was it been created dynamicaly? The command "find / -name stupid-ftpd.*" only finds the FTPD server. But I can still add and delete the users, set up bann to IP addresses etc. And these changes will stay stored on www pages even after router restart. But their influence to FTP server is none.
By the way, I found the way how to cheat it: I created the file stupid-ftp.conf in different directory (/usr/etc/) and I run the FTP server from script /usr/local/sbin/post-boot by the command /usr/sbin/stupid-ftpd -f /usr/etc/stupid-ftpd.conf.

stupid-ftpd.conf is generated by the router on the fly, but for this this will not work if use rootfs (due to missing hotplug events). So, you need to create them manually or add this line to post-boot script:


nvram set usb_storage_device=1




4) If I login o the router using Telnet or SSH, FTP keep listing weird reports to console, such as "Unknown command: 'FEAT'" etc. (It looks like it is not only error messages.) Even adding "&>/dev/null" to the command I use to start the FTP daemon would not work.

This only happens if you start it manually.
start it like this:


stupid-ftpd > /dev/null 2>&1


Check your PM.