Hacking devices can/will void your warranty and can turn your expensive consumer electronics into worthless trash if you don't know what you're doing. This blog is for information purposes only, and if you try to hack into your own consumer electronics, you do so at your own risk. The device I'm currently hacking is the Canon SX10 IS camera.

Friday, May 29, 2009

Getting VSFTP working

In addition to getting SSH working that I just posted about, I also got VSFTP working.

The reason I chose VSFTP was because it was claimed that it was the fastest, or amongst the fastest of the FTP programs. I was not doing it for the ability to use SSL. The setup I describe here is NOT secure, as passwords are transmitted in clear text and susceptible to man-in-the-middle attacks. If you are interested in security, look at SSH. Also, look at the options for VSFTP. I didn't try SSL, so I don't know if it works. But you are welcome to try if security is more important than speed.

Speaking of speed, the fastest connection I was able to get out of it with a wifi was 1.3 MB/sec. Over wired it was 4.1 MB/sec down and 3.0 MB/sec up. So about the same speed as samba for transferring files over the same connection, maybe a little faster, but it was much faster than the BFTP found at RTD1261 wikidot, which clocked at around 500 MB/sec over wifi. Additionally, there is no 2 GB limit problem with VSFTP. I used FileZilla for my FTP transfer tests.

Setup is a little more complicated.

First, download the files: http://www.box.net/shared/68250x4psu

Again, I created the binaries from the new buildroot that I was able to create from the GPLed iomega source. I have a feeling this is what prevented my earlier efforts from working.

Once again, unzip the file into the root directory of the screenplay, preserving the directory structure. If you have previously run IomTools and had to do something like that before, then all you have to do is reboot the machine as the script will automatically run. If not, you will need to run the I10SetupVSFTP.sh script yourself.

When the script is finished, you will need to set up a new user.

The default user, ftp, is anonymous access and will provide read only access to the root of the ScreenPlay. This will automatically be set up for you. If you do not want to provide read only access to anonymous users, you will need to edit the /etc/vsftp/vsftp.conf file.

If you want write access to the drive, You will need to setup an account. You cannot use root unless you change root's home dir. I wouldn't suggest doing that. For this example, I'm going to use the user named ftpuser.

adduser -h /tmp/hddmedia -s /bin/nologon -H ftpuser

you will be prompted for a password. If you want the FTP account password protected (a good idea) then enter the password. If not, just press enter and have no password.

Now you will need to edit the /etc/passwd file to change the default group for the new user. vi /etc/passwd and you'll find a line that looks something like this:

ftpuser:$1$mUZ/dW81$bLAtC7pGOSvh3cnbdmHfm0:1003:1003:Linux user,,,:/tmp/hddmedia:/bin/nologon

That second number, right before "Linux user", is the group number. Change it to 0. yes, that will give that FTP user root privileges. The way I've set up the script, the HDD directory gets changed so that only the root group has access to write to it. The FTP login goes to the HDD directory and is chroot protected so that the screenplay media is the only set of directories the user has access to. I would set the group ownership, but the busybox that comes with the screenplay doesn't have that built in. So the paranoid will need to wait until I publish the new buildroot, or use the old buildroot, it might work. And then you can change the group ownership of the HDD directory.

Anyway, that's it. Enjoy.

Hopefully the way I've done SSH and VSFTP should make it easy to add into IomTools, if SuperBerny so desires. I've also given him the necessary code for manipulating the password, so he can add the feature to IomTools to set the root password and create users.

Edit: After playing around with it for a few days, what I'm experiencing on my local box is a lockup during file transfer. Not very consistent, sometimes it locks up after transferring several GB, but usually locks up after 1-2 GB has been transferred, at least downloading. I'm not sure if this is related to the 1.8 firmware, or the VSFTP program. I had lockups prior to VSFTP, so I'd appreciate feedback from others as to if they are seeing lockups on other firmware versions, or no lockups at all.

Edit 2: I have just updated the VSFTP program by compiling it with v4.2.4 of the GCC compiler. It seems to have solved the lockup problem. I was not only able to upload > 6 GB multiple times, and download > 6 GB, I was also able to upload multiple files simultaneously, which the prior compile was leaving dead processes after trying to do. VSFTP works really well now. I am using firmware R1.8. One note: The R1.0 firmware mounts the HDD with no executable permissions, and as a result, you cannot run the script off of the hard drive. So I would recommend either upgrading to R1.8, or running the script by typing sh < I10SetupVSFTP.sh to execute the script.

7 comments:

  1. HI
    I am a newbie to linux

    when you say modify the second number before the linuxuser in the password file

    will the modified line looks like the one below
    ftpuser:$1$mUZ/dW81$bLAtC7pGOSvh3cnbdmHfm0:1003:0:Linux user,,,:/tmp/hddmedia:/bin/nologon

    Is there a command to removeuser we already created?

    Can you eloborate how to remove annoymus user access

    Thanks

    Babu

    ReplyDelete
  2. Hello, how can I compile directly on the ScreenPlay Pro?
    I see you refering Iomega's GLPed Source, but I can't find it...

    I want to try compiling some wireless drivers...

    Thank you

    ReplyDelete
  3. Babu, you can just delete the user straight from the passwd and group files. But I think you can also use deluser.

    Yes, the modified line will look like what you have listed.

    Read the /etc/vsftp/vsftp.config file to see what is necessary for removing anonymous access. There is a line that you uncomment to make that change. It also points you to the website where you can find all of the configuration variables.


    Anon, the GPL'ed source is at the iomega support website. You will probably want to wait for me to publish the new buildroot, as it lines up better than the other buildroot I have listed on my blog.

    ReplyDelete
  4. Thanks (the last anonymous here).
    I'm trying to use the previous buildroot you've posted...
    Didn't start trying to compile the driver yet...
    When will you post the new builtroot?

    ReplyDelete
  5. There was a mistake in my last post, I used the g+++ toolchain and not the buildroot! (don't know if it's the same thing :S )

    ReplyDelete
  6. Well, tried to compile the drivers with no success... make can't find the linux header files... Are they in the toolchain?

    By the way, the drivers are this ones:
    http://www.ralinktech.com.tw/data/drivers/2009_0521_RT2870_Linux_STA_V2.1.2.0.tgz

    Is it possible at all to make them work on SSP?

    ReplyDelete
  7. DeadVirus, I'm using the term buildroot because I used the buildroot at buildroot.uclibc.com as a way to build the toolchain. The original toolchain I published came from a slightly modified buildroot.

    The way I'm approaching the new buildroot is to publish the buildroot itself. So instead of using the ScreenPlay to do the compiling, which takes forever, you would use the PC toolchain and just copy the files you need.
    There's a few more glitches I'm trying to work out, including VSFTP. But I'm shooting to have that published this week, depending upon how much my work interferes with my personal time.

    ReplyDelete