Posted by on August 17, 2010

[UPDATE]

This is a 32bit binary, which I think needs some pretty old kernel version. Hence it only works on 4.0, I will try and get an updated release for 4,1 (*note) ESXi 5 comes with sftp-server already.

 

I came across something interesting while fiddling earlier, after spending about 2 hours building a static release of openssh server that was going to replace dropbear. I’d gotten to a point where I could build a i386 release of the binaries with no random library requirements and sshd would start and listen on a port defined in /etc/ssh/sshd_config. unfortunately starting ssh in debug mode allowed me to see numerous glibc errors during connections and explain why I couldn’t connect. At this point I don’t think there is any real way of replacing dropbear with a complete openssh solution even statically linking. Even testing the openssh sftp binary that had been compiled showed that it wasn’t coping with a system call not returning UIDs correctly meaning that it would report a FATAL error and close continually.

Given openssh wasn’t going to be replaced I researched about dropbear and if there was a newer version perhaps with sftp, unfortunately not. Eventually I came across notes on a blog mentioning that dropbear “supports” openssh sftp. After restoring ESXi back to its default filesystem settings (ssh enabled) it appears the attempting to sftp to esxi returns the following error.

ash: /sbin/sftp-server: not found
Connection closed

After compiling a slightly older version of openssh (static) I found a release of sftp-server that will once placed in /sbin on ESXi allows full usage of sftp (including sshfs mounting) binary below.

sftp-server.tar.gz

 

 

 

 

 

 

 

Comments

  1. Chris
    September 14, 2010

    Thank you!

    I just wasted 2 hours trying to get a file over to my esxi server using a variety of methods (SCP is horrible).

    This solved the problem!

  2. dan
    September 16, 2010

    No problem,

    It’s pretty irritating sometimes needing to get to the underlying file systems, and the windows GUI for uploading iso’s etc is awful.

    –Dan

  3. Philipp
    September 20, 2010

    Hi there,

    thank you very much for this great peace of software 😀

    But with the current version of ESXi server there’s a small problem: After every reboot the file gets deleted by an autobackup script. Is there any way to retain the file even after reboot?

    Thank you very much for your effort,

    Philipp

  4. dan
    October 5, 2010

    Unfortunately, most of the filesystems are recreated from archives on reboot, so any new files will be removed upon reboot.

    –Dan

  5. toine
    October 23, 2010

    Thx Dan

    this was the trick for sshfs to the esxi host

    by the way works also with esxi4

    Thx

  6. esxiuser
    December 2, 2010

    Why not just use plain ftp server instead of sftp server?

  7. dan
    December 2, 2010

    Two reasons,

    1. Security, allowing/enabling SSH on ESXi is something that is part of the design of ESXi. Having an SSH port open on your network is relatively normal these days, were as having ftp open is less likely. Also the fact that there is no encryption with FTP.
    2. FuSE, One of the goals was to be able to mount areas of the file system. There is an FTP Fuse file system, however it buffers the entire file in memory before writing it to disk, which means copying a VM (~40GB) would mean the FuSE ftp file system filling up 40Gb of memory before writing the file to disk. The SSHFS filesystem doesn’t do such crazy things.

    –Dan

  8. Chris
    December 7, 2010

    A very Big Up for the Tip !!!

  9. Eoin
    January 31, 2011

    Outstanding tip! It’s brutally slow for large file transfers, of course, but now with WinSCP I can easily browse around the ESXi filesystem and edit config files, etc. in a graphical environment. For those who need copy/paste instructions to implement this:
    log in to the ESXi box

    cd /sbin
    wget http://thebsdbox.co.uk/wp-content/uploads/2010/08/sftp-server.tar.gz
    tar xzvf sftp-server.tar.gz
    rm sftp-server.tar.gz

    and log out again.

  10. Edwin
    March 18, 2011

    Hi, I’m a newbie in esxi 4.1. I want to backup my vmdk files to other harddisk outside the server. so I tried to use ssh and using your recommendation, I finally can log in using sftp to my server but I still can’t copy vmdk files and the connection always close with error value 139 right after I tried to copy my files… Does anyone know the answer of my problem?? Thanks a lot…

  11. Ulli Horlacher
    April 22, 2011

    “After compiling a slightly older version of openssh (static) ”

    Which version was this?

    I want to compile it by myself.

  12. Ulli Horlacher
    April 22, 2011

    … and how did you compile it statically?
    The default configure script has no option for static linking.

  13. Ulli Horlacher
    April 26, 2011

    How did you compile sftp-server?
    I would like to compile it by myself

  14. Will
    May 19, 2011

    To make the change permanent so it doesn’t go away on reboots, do the following:

    mkdir /tmp/oem
    cd /tmp/oem
    tar -zxvf /bootbank/oem.tgz
    cp -p /sbin/sftp-server sbin
    tar -zcvf /bootbank/oem.tgz *
    cd /
    rm -rf /tmp/oem

    This will add the sftp-server to the /bootbank/oem.tgz file which gets extracted during the system boot.

  15. thunderw
    July 8, 2011

    It works perfect. Thank you for sharing.

  16. johnm
    July 8, 2011

    I used these instructions to SFTP-enable a pair of ESXi 4.1 servers (build 348481). It all looked promising until I tried to pull some files off them. Small files worked, bigger ones didn’t. The FileZilla log reported the ESXi end dropped the connection with an exit code 139. After further testing I’m apparently finding taht files bigger than 4082 bytes can’t be pulled off the ESXi server using this SFTP mechanism. At 4082 bytes or below all works well. I’ve tested with two different SFTP clients, so am mystified about what’s going on here or how to dig deeper.

  17. Olly
    July 27, 2011

    @Will
    Hy,
    I’m german but I hope you help me anyway.
    I enabled SSH on my ESX4.1i, to get access with my Ubuntu10.04 machine I had to type what you wrote on the ESX. I can make a connection with W7 and Putty, is this correct ?
    I’m not so firm in linux.

    BW olly

  18. Seth
    October 31, 2011

    Let me start by saying thanks for the work. Saved me a bunch of time. Now the part that makes me sad. I’m having a hard time with “ls” segfaulting the server process. I have a feeling it might be related to Johnm’s comment above. It seems that any file listing over around 4k causes the problem…

  19. dan
    October 31, 2011

    I have a theory, it might be worth taking the ssh binaries from ESXi 5.0 and trying them on ESXi 4.0 (probably not legal though). Sadly i’ve upgraded my lab to purely ESXi 5 and have no ESXi 4 boxes to test this with. Email me and i’ll send you the other binaries?

    –Dan

  20. Minkiux
    January 31, 2012

    I’ve tried sftp-binary from ESXi 5.0 on an ESXi 4.1 host, and I’v got the same “SIGSEGV” problem when transferring >4kb file…

  1. EFFITEK » Support SFTP sur VMware ESXi 4.1.0-258902 - [...] Etant donnĂ© que l’Ă©diteur a utilisĂ© Dropbear 0.52 pour implĂ©menter SSH, la solution consiste soit Ă  compiler la mĂȘme…
  2. EFFITEK » Support SFTP sur VMware ESXi 4.1.0-258902 - [...] Etant donné que l'éditeur a utilisé Dropbear 0.52 pour implémenter SSH, la solution consiste soit à compiler la même…
  3. DevLink - IT-Blog - […] SFTP installieren https://technet.microsoft.com/en-us/library/gg610672(v=sc.12).aspx […]

Leave a Reply


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*