ESXi v4.1 SFTP access


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.









23 thoughts on “ESXi v4.1 SFTP access”

  1. 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. 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.


  3. 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,


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


  5. 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.


  6. 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…

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

    Which version was this?

    I want to compile it by myself.

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

  9. 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.

  10. 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.

  11. @Will
    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

  12. 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…

  13. 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?


  14. 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…

  15. Pingback: DevLink - IT-Blog

Leave a Reply

Your email address will not be published. Required fields are marked *