# SftpContainerResource.WithHostKeyFile

- Module: [CommunityToolkit.Aspire.Hosting.Sftp](/reference/api/go/communitytoolkit.aspire.hosting.sftp.md)
- Defined on: [SftpContainerResource](/reference/api/go/communitytoolkit.aspire.hosting.sftp/sftpcontainerresource.md)
- Version: `13.6.1`
- Kind: `method`

Adds a bind mount for the specified host key file to an SFTP container resource.

## Remarks

Add an SFTP container to the application model with the host key in the specified file.
```
var builder = DistributedApplication.CreateBuilder(args);
builder.AddSftp("sftp").WithHostKeyFile("./etc/ssh/ssh_host_ed25519_key", KeyType.Ed25519);
builder.Build().Run();
```

## Definition

```go
type SftpContainerResource interface {
    // ... omitted for brevity
    WithHostKeyFile(
        keyFile string,
        keyType KeyType,
    ) SftpContainerResource
}
```

## Signature

```go
WithHostKeyFile(
    keyFile string,
    keyType KeyType,
) SftpContainerResource
```

## Parameters

- `keyFile` (`string`) -- The path to the host key file.
- `keyType` ([`KeyType`](/reference/api/go/communitytoolkit.aspire.hosting.sftp/keytype.md)) -- The type of the host key.

## Returns

[`SftpContainerResource`](/reference/api/go/communitytoolkit.aspire.hosting.sftp/sftpcontainerresource.md) -- The `IResourceBuilder`.

Returns a handle; failures surface later via `Err()`.

## Defined on

- [SftpContainerResource](/reference/api/go/communitytoolkit.aspire.hosting.sftp/sftpcontainerresource.md) -- `handle`
