Skip to Content
SSHSSH users

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.

manageAppSshUsers.js
1
const users = await client.apps.ssh.users.list({
2
  app: "da_XYZ",
3
  limit: 10,
4
});
5
// Should return: { "data": [ { "id": "ssh_user_abc", "username": "u123", ... } ], "hasMore": false }// { ... }
6
console.log(users.data);

Update a user

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

manageAppSshUsers.js
1
const user = users.data[0];
2
const updated = await client.apps.ssh.users.update(user.id, {
3
  authenticationMethods: ["PASSWORD", "PUBLIC_KEY"], // options: "PASSWORD", "PUBLIC_KEY", or both
4
});
5
// Should return: {// { ... }
13
console.log(updated.username, updated.serverHost, updated.port);

Source: stackmachine/sdks  examples.