---
title: "SSH server"
description: "Enable SSH and read server settings for an app."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.stackmachine.com/llms.txt
> Use this file to discover all available pages before exploring further.

# SSH server

Read SSH server settings for an app, then list users attached to that server.

### Read server settings

Call `client.apps.ssh.retrieve` with the app ID. Check `enabled` before connecting users.

```javascript
const sshServer = await client.apps.ssh.retrieve("da_XYZ");
// Should return: {
//   "id": "ssh_server_abc",
//   "enabled": true
// }
console.log(sshServer.id, sshServer.enabled);
```

```python
server = client.apps.ssh.retrieve("da_XYZ")
# Should return: {
#   "id": "ssh_server_abc",
#   "enabled": true
# }
print(server.id, server.enabled)
```

### List SSH users

List users for the app. Each entry includes `username`, `port`, and `serverHost` / `server_host` for connections.

```javascript
const users = await client.apps.ssh.users.list({ app: "da_XYZ", limit: 10 });
// Should return: {
//   "data": [
//     {
//       "id": "ssh_user_abc",
//       "username": "u123",
//       "port": 22,
//       "serverHost": "ssh.example.com",
//       "sftpRootFolder": "/"
//     }
//   ],
//   "hasMore": false
// }
console.log(users.data);
```

```python
users = client.apps.ssh.users.list(app="da_XYZ", limit=10)
# Should return: {
#   "data": [
#     { "id": "ssh_user_abc", "username": "u123", "port": 22, "server_host": "ssh.example.com" }
#   ],
#   "has_more": false
# }
print(users.data)
```

> Source: [stackmachine/sdks](https://github.com/stackmachine/sdks/tree/main) examples.

Source: https://docs.stackmachine.com/apps/ssh/server/index.mdx
