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
Delete the service account that accesses Cloud Storage resources on behalf of the user:
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.Delete the service account:
gcloud iam service-accounts delete SERVICE_ACCOUNT
Replace
SERVICE_ACCOUNTwith the email address of the service account.
To delete the user from an SFTP server, run the
gcloud alpha storage ftp users deletecommand.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
gcloud alpha storage ftp users delete USERNAME --location=LOCATION_ID \ --server=SERVER_ID
Windows (PowerShell)
gcloud alpha storage ftp users delete USERNAME --location=LOCATION_ID ` --server=SERVER_ID
It takes a few seconds for the user to be deleted.Windows (cmd.exe)
gcloud alpha storage ftp users delete USERNAME --location=LOCATION_ID ^ --server=SERVER_ID
REST
Delete the service account that accesses Cloud Storage resources on behalf of the user:
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.Delete the service account:
gcloud iam service-accounts delete SERVICE_ACCOUNT
Replace
SERVICE_ACCOUNTwith the email address of the service account.
To delete the user from an SFTP server, use the
servers.users.deletemethod.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:
The response identifies a long-running operation. It takes a few seconds for the user to be deleted.