---
name: "libssh2_sftp_shutdown"
section: "3"
platform: "linux"
package: "libssh2"
version: "1.11.1-7"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/libssh2_sftp_shutdown"
---

# libssh2\_sftp\_shutdown(3)

shut down an SFTP session

## NAME

libssh2\_sftp\_shutdown - shut down an SFTP session

## SYNOPSIS

```
#include <libssh2.h>
#include <libssh2_sftp.h>
int
libssh2_sftp_shutdown(LIBSSH2_SFTP *sftp);
```

## DESCRIPTION

*sftp* - SFTP instance as returned by **[libssh2\_sftp\_init(3)](/libssh2_sftp_init/3.md)**

Destroys a previously initialized SFTP session and frees all resources associated with it.

## RETURN VALUE

Return 0 on success or negative on failure. It returns LIBSSH2\_ERROR\_EAGAIN when it would otherwise block. While LIBSSH2\_ERROR\_EAGAIN is a negative number, it is not really a failure per se.

## SEE ALSO

**[libssh2\_sftp\_init(3)](/libssh2_sftp_init/3.md)**
