Recently I encountered a lack of diskspace problem on a SFTP server and I realised I have no idea how to check how much is left or even the total amount.

Does anyone know how to do this through an application like FileZilla or perhaps there is a command that can be used for this purpose?

Note that the server is hosted at a third party and I was hoping there was a way to answer this question without going through them.


I tried connecting via shell using both putty and cygwin ssh. Putty silently failed while cygwin gave me the following error message:

$ ssh [user]@[host] -i "[priv.key]"
Last login: Wed Aug 17 12:54:46 2011 from
Could not chdir to home directory /local00/ftproot/[user]: No such file or directory
/usr/local/sbin/scponlyc: No such file or directory
Connection to [host] closed.

Any ideas?

  • 1
    Do you have shell access to the server? – Sven Aug 17 '11 at 8:51
  • I tried connecting through PuTTy and SSH using the same user, host and private key but just as the authentication process starts the window closes. I'm not sure how to interpret this whether or not authentication failed or if i don't have shell access.. I can connect with the same login with FileZilla – kjetilh Aug 17 '11 at 10:26
  • Please see my updated question – kjetilh Aug 17 '11 at 11:02
  • 1
    Well, as answered by mailq in this case you're done : there's no way to check in a scponly environment. – François Feugeas Aug 17 '11 at 13:24

The scponly shell may allow the quota command (if enabled). But it seems that you have the scponly configured to support the SFTP only, with a shell access disallowed.

The SFTP protocol allows checking disk space (contrary to what other answers say).

Extracting from the SFTP - check free space available question of stackoverflow.com:

SFTP protocol version 6 lets one check available space (SSH_FXP_EXTENDED request name space-available). Most SSH/SFTP servers (notably OpenSSH, as the one the most widespread) support SFTP version 3 only though.

OpenSSH on the other hand supports statvfs@openssh.com proprietary extension.

The OpenSSH extension is supported by some SFTP clients.

  • Obviously by the OpenSSH sftp client via the df command:

    df [-hi] [path]
    Display usage information for the filesystem holding the current directory (or path if specified). If the -h flag is specified, the capacity information will be displayed using "human-readable" suffixes. The -i flag requests display of inode information in addition to capacity information. This command is only supported on servers that implement the ''statvfs@openssh.com'' extension.

    sftp> df -h
        Size     Used    Avail   (root)    %Capacity
       591GB    358GB    203GB    233GB          60%
  • WinSCP also supports it (see Server and Protocol Information Dialog):

    WinSCP Server and Protocol Information Dialog

    (I'm the author of WinSCP)

  • Yeap, after using command-line sftp to connect to the server, one can use df -h / to check free space etc – LyK Apr 2 '15 at 15:48
  • Unfortunately not all servers support that: sftp> df Server does not support statvfs@openssh.com extension – Thomas Lauria Sep 27 '18 at 6:31
  • @ThomasLauria It's a proprietary extension of OpenSSH. While some other servers may opt to support it as well, not all do. – Martin Prikryl Sep 27 '18 at 6:35
ssh <host> df -h

Will give you all of the necessary information, in the absence of things like disk quotas. If you don't have shell access (or some way of running commands, such as via PHP exec), then you can't check disk space, but then again, if you don't have shell, how can it be your responsibility to administer the server and manage disk space?

  • Well, it's not strictly my responsibility, but I've written some exporting/importing scripts regarding the SFTP server and I'm notified of the errors triggered. Ultimately we would like to adjust/rewrite the cleanup process but now I just want some more information – kjetilh Aug 17 '11 at 10:30

With the SFTP command set there is no possibility to get the available size or the space used.

If you are able to SSH to the server (same host, user, password) you could issue a df -h to see the space available. Or a du -h in the folder to see the used space of the folder.

  • It's not true that SFTP does not allow getting disk usage. See my other answer. – Martin Prikryl Dec 27 '13 at 12:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.