---
title: "SSH users"
description: "List and manage SSH users on 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 users

List SSH users on an app, then update authentication settings for one user.

### List SSH users

Pass the app ID and an optional `limit`. Use `users.data` to pick a user to update.

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

```python
users = client.apps.ssh.users.list(app="da_XYZ", limit=10)
print(users.data)
```

### Update a user

Set `authenticationMethods` / `authentication_methods` to `PASSWORD`, `PUBLIC_KEY`, or both.

```javascript
const user = users.data[0];
const updated = await client.apps.ssh.users.update(user.id, {
  authenticationMethods: ["PASSWORD", "PUBLIC_KEY"], // options: "PASSWORD", "PUBLIC_KEY", or both
});
// Should return: {
//   "id": "ssh_user_abc",
//   "username": "u123",
//   "port": 22,
//   "serverHost": "ssh.example.com",
//   "sftpRootFolder": "/",
//   "authenticationMethods": ["PASSWORD", "PUBLIC_KEY"]
// }
console.log(updated.username, updated.serverHost, updated.port);
```

```python
user = users.data[0]
updated = client.apps.ssh.users.update(
    user.id,
    authentication_methods=["PASSWORD", "PUBLIC_KEY"],  # options: "PASSWORD", "PUBLIC_KEY", or both
)
# Should return: {
#   "id": "ssh_user_abc",
#   "username": "u123",
#   "port": 22,
#   "server_host": "ssh.example.com",
#   "authentication_methods": ["PASSWORD", "PUBLIC_KEY"]
# }
print(updated.username, updated.server_host, updated.port)
```

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

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