Get SFTP user information

This document shows how to get information about your Cloud FTP users. You can list all users for a server. You can also get detailed information about a specific user, such as the user's Cloud Storage directory mappings and permissions.

Required roles

To get the permissions that you need to get information about SFTP users, ask your administrator to grant you the Cloud FTP Viewer (roles/ftp.viewer) IAM role on your project. For more information about granting roles, see Manage access to projects, folders, and organizations.

This predefined role contains the permissions required to get information about SFTP users. To see the exact permissions that are required, expand the Required permissions section:

Required permissions

The following permissions are required to get information about SFTP users:

  • List users: ftp.users.list
  • Get user details: ftp.users.get

You might also be able to get these permissions with custom roles or other predefined roles.

List users

gcloud

To list SFTP users for a server, run the gcloud alpha storage ftp users list command.

Before using any of the command data below, make the following replacements:

  • LOCATION_ID: the location of the server, such as us-west1.
  • SERVER_ID: the server ID.

Execute the following command:

Linux, macOS, or Cloud Shell

gcloud alpha storage ftp users list --location=LOCATION_ID --server=SERVER_ID

Windows (PowerShell)

gcloud alpha storage ftp users list --location=LOCATION_ID --server=SERVER_ID

Windows (cmd.exe)

gcloud alpha storage ftp users list --location=LOCATION_ID --server=SERVER_ID

REST

To list SFTP users for a server, use the servers.users.list method.

Before using any of the request data, make the following replacements:

  • PROJECT_ID: the Google Cloud project ID.
  • LOCATION_ID: the location of the server, such as us-west1.
  • SERVER_ID: the server ID.

HTTP method and URL:

GET https://ftp.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/servers/SERVER_ID/users

To send your request, expand one of these options:

The response body is a JSON object with a list of User resources.

Get details about a user

To get detailed information about a specific user, such as the user's Cloud Storage directory mappings and permissions, the email address of the service account that accesses Cloud Storage resources on behalf of the user, and the user's credentials, use the following steps.

gcloud

To get details about an SFTP user, run the gcloud alpha storage ftp users describe command.

Before using any of the command data below, make the following replacements:

  • USERNAME: the SFTP user's username.
  • LOCATION_ID: the location of the server, such as us-west1.
  • SERVER_ID: the SFTP server ID.

Execute the following command:

Linux, macOS, or Cloud Shell

gcloud alpha storage ftp users describe USERNAME --location=LOCATION_ID \
    --server=SERVER_ID

Windows (PowerShell)

gcloud alpha storage ftp users describe USERNAME --location=LOCATION_ID `
    --server=SERVER_ID

Windows (cmd.exe)

gcloud alpha storage ftp users describe USERNAME --location=LOCATION_ID ^
    --server=SERVER_ID

REST

To get details about an SFTP user, use the servers.users.get method.

Before using any of the request data, make the following replacements:

  • PROJECT_ID: the Google Cloud project ID.
  • LOCATION_ID: the location of the server, such as us-west1.
  • SERVER_ID: the SFTP server ID.
  • USERNAME: the SFTP user's username.

HTTP method and URL:

GET https://ftp.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/servers/SERVER_ID/users/USERNAME

To send your request, expand one of these options:

The response body is a User resource.