---
name: "libssh2_agent_connect"
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_agent_connect"
---

# libssh2\_agent\_connect(3)

connect to an ssh-agent

## NAME

libssh2\_agent\_connect - connect to an ssh-agent

## SYNOPSIS

```
#include <libssh2.h>
int
libssh2_agent_connect(LIBSSH2_AGENT *agent);
```

## DESCRIPTION

Connect to an ssh-agent running on the system.

Call **[libssh2\_agent\_disconnect(3)](/libssh2_agent_disconnect/3.md)** to close the connection after you are doing using it.

## RETURN VALUE

Returns 0 if succeeded, or a negative value for error.

## AVAILABILITY

Added in libssh2 1.2

## SEE ALSO

**[libssh2\_agent\_init(3)](/libssh2_agent_init/3.md)** **[libssh2\_agent\_disconnect(3)](/libssh2_agent_disconnect/3.md)**
