Delete users from an SFTP server

This document shows how to remove a user from a Cloud FTP server.

Required roles

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

This predefined role contains the ftp.users.delete permission, which is required to delete SFTP users.

You might also be able to get this permission with custom roles or other predefined roles.

Delete an SFTP user

gcloud

  1. Delete the service account that accesses Cloud Storage resources on behalf of the user:

    1. Get the email address of the user's service account. For example, USERNAME-sa@PROJECT_ID.iam.gserviceaccount.com. For steps, see Get details about a user.

    2. Delete the service account:

      gcloudiamservice-accountsdeleteSERVICE_ACCOUNT

      Replace SERVICE_ACCOUNT with the email address of the service account.

  2. To delete the user from an SFTP server, run the gcloud alpha storage ftp users delete 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 server ID.

    Execute the following command:

    Linux, macOS, or Cloud Shell

    gcloudalphastorageftpusersdeleteUSERNAME--location=LOCATION_ID\
    --server=SERVER_ID

    Windows (PowerShell)

    gcloudalphastorageftpusersdeleteUSERNAME--location=LOCATION_ID`
    --server=SERVER_ID

    Windows (cmd.exe)

    gcloudalphastorageftpusersdeleteUSERNAME--location=LOCATION_ID^
    --server=SERVER_ID
    It takes a few seconds for the user to be deleted.

REST

  1. Delete the service account that accesses Cloud Storage resources on behalf of the user:

    1. Get the email address of the user's service account. For example, USERNAME-sa@PROJECT_ID.iam.gserviceaccount.com. For steps, see Get details about a user.

    2. Delete the service account:

      gcloudiamservice-accountsdeleteSERVICE_ACCOUNT

      Replace SERVICE_ACCOUNT with the email address of the service account.

  2. To delete the user from an SFTP server, use the servers.users.delete 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.
    • USERNAME: the SFTP user's username.

    HTTP method and URL:

    DELETE 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:

    curl (Linux, macOS, or Cloud Shell)

    Execute the following command:

    curl -X DELETE \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    "https://ftp.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/servers/SERVER_ID/users/USERNAME"

    PowerShell (Windows)

    Execute the following command:

    $cred = gcloud auth print-access-token
    $headers = @{ "Authorization" = "Bearer $cred" }

    Invoke-WebRequest `
    -Method DELETE `
    -Headers $headers `
    -Uri "https://ftp.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/servers/SERVER_ID/users/USERNAME" | Select-Object -Expand Content
    The response identifies a long-running operation. It takes a few seconds for the user to be deleted.

What's next

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026年08月26日 UTC.