When transferring data to an on-premises or private cloud file system (such as POSIX, NFS, or SMB), you must configure the following:
- Local file system permissions: Grant the destination transfer agents OS-level write access to your target directories.
- Intermediate bucket permissions (file-to-file only): Grant IAM roles on the intermediate Cloud Storage bucket used to stage files between file systems.
Prerequisites
- User permissions: Ensure your user account or user-managed service account has permission to configure transfer jobs and agent pools. See Required user permissions.
- Agent-based project-level permissions: Ensure you have configured the required project-level roles for your service agent and transfer agent account. See Agent-based project-level permissions.
Local target file system permissions
Transfer agents write files directly to your host file system. To enable successful writes:
OS user permissions: Ensure the operating system user running the container process has read, write, and execute permissions on the destination directory tree.
Mount directories: When installing your destination agents, mount the target directory path into the container using the
--mount-directoriesflag:gcloud transfer agents install --pool=DESTINATION_POOL_NAME \ --mount-directories=/path/to/destination/dir
Intermediate bucket permissions (file-to-file transfers)
Transfers between two file systems use an intermediate Cloud Storage bucket to stage files during transfer.
The following predefined roles grant the required access on the intermediate bucket to the service agent:
- Storage Object Creator (
roles/storage.objectCreator) - Storage Object Viewer (
roles/storage.objectViewer) - Storage Legacy Bucket Reader (
roles/storage.legacyBucketReader)
The following role grants the required access on the intermediate bucket to the transfer agent account(s):
- Storage Object User (
roles/storage.objectUser)
Grant these roles on the intermediate bucket:
Console
- In the Google Cloud console, go to the Cloud Storage Buckets page.
- Click the Bucket overflow menu () for the intermediate bucket and select Edit access.
- Click + Add principal.
- In New principals, enter your service agent email.
- Select
Storage Object Creator,Storage Object Viewer, andStorage Legacy Bucket Readerfrom the Select a role drop-down menus. - Click + Add principal again.
- Enter the email address of the transfer agent account(s) used for your source and destination agent pools.
- Select
Storage Object Userfrom the Select a role drop-down menu. - Click Save.
gcloud
Grant logging and metadata roles to the service agent:
gcloud storage buckets add-iam-policy-binding gs://INTERMEDIATE_BUCKET_NAME \ --member=serviceAccount:SERVICE_AGENT_EMAIL --role=roles/storage.objectCreatorgcloud storage buckets add-iam-policy-binding gs://INTERMEDIATE_BUCKET_NAME \ --member=serviceAccount:SERVICE_AGENT_EMAIL --role=roles/storage.objectViewergcloud storage buckets add-iam-policy-binding gs://INTERMEDIATE_BUCKET_NAME \ --member=serviceAccount:SERVICE_AGENT_EMAIL --role=roles/storage.legacyBucketReaderGrant object management roles to the transfer agent account(s) for both the source and destination agent pools:
gcloud storage buckets add-iam-policy-binding gs://INTERMEDIATE_BUCKET_NAME \ --member=serviceAccount_OR_user:TRANSFER_AGENT_ACCOUNT --role=roles/storage.objectUserReplace:
- INTERMEDIATE_BUCKET_NAME: The name of your intermediate staging bucket.
- SERVICE_AGENT_EMAIL: The service agent email.
- serviceAccount_OR_user: Specify either
serviceAccountif your transfer agent account is a service account, oruserif your agents were installed with a user account. - TRANSFER_AGENT_ACCOUNT: The email of the account running the transfer agents. Repeat this command if your source and destination agent pools use different accounts.
REST API
Generate an access token to authenticate your request. If you are using the
gcloudCLI, run:gcloud auth print-access-token
Retrieve the existing bucket IAM policy (
GET https://storage./storage/v1/b/<var>INTERMEDIATE_BUCKET_NAME</var>/iam), append the following bindings to itsbindingsarray, and save the merged policy asintermediate_policy.json:{ "bindings": [ { "role": "roles/storage.objectCreator", "members": ["serviceAccount:SERVICE_AGENT_EMAIL"] }, { "role": "roles/storage.objectViewer", "members": ["serviceAccount:SERVICE_AGENT_EMAIL"] }, { "role": "roles/storage.legacyBucketReader", "members": ["serviceAccount:SERVICE_AGENT_EMAIL"] }, { "role": "roles/storage.objectUser", "members": ["serviceAccount_OR_user:TRANSFER_AGENT_ACCOUNT"] } ] }
Replace:
- SERVICE_AGENT_EMAIL: The service agent email.
- serviceAccount_OR_user: Specify either
serviceAccountif your transfer agent account is a service account, oruserif your agents were installed with a user account. - TRANSFER_AGENT_ACCOUNT: The email of the account that installed your transfer agents. If your source and destination agent pools use different accounts, include both accounts in the
membersarray forroles/storage.objectUser.
Update the intermediate bucket policy via
curl:curl -X PUT --data-binary @intermediate_policy.json \ -H "Authorization: Bearer OAUTH2_TOKEN" \ -H "Content-Type: application/json" \ "https://storage./storage/v1/b/INTERMEDIATE_BUCKET_NAME/iam"Replace:
- OAUTH2_TOKEN: The OAuth 2.0 access token generated in step 1.
- INTERMEDIATE_BUCKET_NAME: The name of your intermediate bucket.
For more information on file-to-file architectures, see File system to file system transfers.
Performance and optimization
- To maximize throughput when transferring to large file systems, install multiple agents in your destination agent pool (recommended minimum of 3). See Best practices for transfer agents.
- For large files in file-to-file transfers, consider enabling multipart uploads to the intermediate bucket. When using Storage Object User (
roles/storage.objectUser), required multipart upload permissions (storage.multipartUploads.*) are included automatically.
What's next
- Learn how to Install transfer agents.
- Learn how to Configure access to a source: file system.
- Learn how to Configure access to a source: Cloud Storage.
- Learn how to Transfer data between file systems.