[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-09-03。"],[],[],null,["# Boto configuration file\n\n| **Important:** gsutil is not the recommended CLI for Cloud Storage. [Use\n| `gcloud storage`](/storage/docs/discover-object-storage-gcloud) commands in the Google Cloud CLI instead.\n\nThis page describes how gsutil uses a boto configuration file and provides\na collaboration example that uses the file. The boto configuration file is\nalso used by boto, which is the Amazon S3 SDK for Python.\n| **Note:** boto3 is not supported with gsutil.\n\nConfiguration file overview\n---------------------------\n\nThe boto configuration file contains values that control how gsutil behaves. For\nexample, the `prefer_api` variable determines which API gsutil preferentially\nuses. Boto configuration file variables can be changed by editing the\nconfiguration file directly. While most users won't need to edit these\nvariables, those do typically do so for one of the following reasons:\n\n- Setting up gsutil to work through a proxy.\n- Using [customer-managed or customer-supplied encryption keys](/storage/docs/encryption).\n- Performing specialized customization of global gsutil behavior.\n\n### Location\n\nThe default location for the boto configuration file is in the user home\ndirectory, \\~/.boto, for Linux and macOS, and in %HOMEDRIVE%%HOMEPATH%,\nfor Windows. You can get the location of the configuration file by running\nthe command `gsutil version -l`.\n\nYou can override where gsutil expects to find the config file by setting the\n`BOTO_CONFIG` environment variable. You can also set up a path of boto\nconfiguration files to load by setting the `BOTO_PATH` environment variable\nusing a `:` delimited path (or `;` for Windows). For example, setting the\n`BOTO_PATH` environment variable to: \n\n```\n/etc/projects/my_group_project.boto.cfg:/home/mylogin/.boto\n```\n\ncauses gsutil to load each configuration file found in the path in order.\nThis is useful if you want to set up some shared configuration state among many\nusers. See the [example of using the configuration file](#example) for such a\ndata sharing and collaboration scenario.\n\n### Structure\n\nThe configuration file contains a number of sections: `[Credentials]`, `[Boto]`,\n`[GSUtil]`, and `[OAuth2]`. The following are the currently defined\nconfiguration settings, broken down by section. Their use is documented in the\nboto configuration file itself, in comments preceding each setting: \n\n```\n[Credentials]\n aws_access_key_id\n aws_secret_access_key\n gs_access_key_id\n gs_host\n gs_host_header\n gs_json_host\n gs_json_host_header\n gs_json_port\n gs_oauth2_refresh_token\n gs_port\n gs_secret_access_key\n gs_service_client_id\n gs_service_key_file\n gs_service_key_file_password\n s3_host\n s3_host_header\n s3_port\n\n[Boto]\n proxy\n proxy_type\n proxy_port\n proxy_user\n proxy_pass\n proxy_rdns\n http_socket_timeout\n ca_certificates_file\n https_validate_certificates\n debug\n max_retry_delay\n num_retries\n\n[GoogleCompute]\n service_account\n\n[GSUtil]\n check_hashes\n content_language\n decryption_key1 ... 100\n default_api_version\n disable_analytics_prompt\n encryption_key\n json_api_version\n max_upload_compression_buffer_size\n parallel_composite_upload_component_size\n parallel_composite_upload_threshold\n sliced_object_download_component_size\n sliced_object_download_max_components\n sliced_object_download_threshold\n parallel_process_count\n parallel_thread_count\n gzip_compression_level\n prefer_api\n resumable_threshold\n resumable_tracker_dir (deprecated in 4.6, use state_dir)\n rsync_buffer_lines\n software_update_check_period\n state_dir\n tab_completion_time_logs\n tab_completion_timeout\n task_estimation_threshold\n test_cmd_regional_bucket_location\n test_notification_url\n use_magicfile\n test_hmac_service_account\n test_hmac_alt_service_account\n test_hmac_list_service_account\n\n[OAuth2]\n client_id\n client_secret\n oauth2_refresh_retries\n provider_authorization_uri\n provider_label\n provider_token_uri\n token_cache\n```\n\nWhen you edit the file, be careful not to mis-edit any of the setting names,\nsuch as `gs_access_key_id`, and don't remove the section delimiters, such as\n`[Credentials]`.\n\n### Updating to the latest configuration file\n\nNew configuration controllable features are added to the boto configuration file\nover time, but most gsutil users create a configuration file once and then\nkeep it for a long time. This means that new features aren't apparent when you\nupdate to a newer version of gsutil. If you want to get the latest configuration\nfile, which includes the latest settings and documentation, rename your current\nfile (e.g., to `.boto_old`), run `gcloud init` (or if using a legacy stand-alone\nversion of gustil, `gsutil config` with the `-a` or `-e` flags), and then\ntransfer any configuration settings you want to keep from your old file into the\nnewly created file. Note, however, that if you're using OAuth2 credentials and\nyou go back through the OAuth2 configuration process, doing so invalidates your\nprevious OAuth2 credentials.\n\nExample using the configuration file\n------------------------------------\n\nIn this example, a small company wants to use Cloud Storage as a storage\nsystem for their employees. As the IT administrator, you create a project in the\nGoogle Cloud console and create buckets for each employee. To make it easier\nfor employees to use Cloud Storage, you want to create and store\ncompany-wide settings, such as a proxy configuration and parallel composite\nupload thresholds, in a central file that employees can point to in their BOTO\nconfiguration path. This eliminates the need for each employee to set the\nshared parts of the configuration manually and allows you, as the administrator,\nto easily change these shared configurations if necessary.\n\nTo accomplish this, perform the following steps:\n\n1. **Create a central boto configuration file that is readable by all employees.**\n\n This can be done by using `gcloud init`.\n\n The boto configuration file might contain, for example: \n\n ```\n [Boto]\n proxy = yourproxy.com\n proxy_port = 8080\n proxy_type = http\n \n [GSUtil]\n parallel_composite_upload_threshold = 150M\n ```\n | **Note:** `socks4` and `socks5` proxies are also supported for `proxy_type`.\n2. **Instruct employees to [install the Google Cloud CLI](/storage/docs/gsutil_install#sdk-install).**\n\n During installation, employees need to specify the project ID that the\n company is using. They also need to [generate individual authentication credentials](/storage/docs/gsutil_install#authenticate)\n because you should never share authentication credentials centrally.\n3. **Instruct employees to add a BOTO_PATH environment variable.**\n\n The BOTO_PATH environment variable lists the path of the centrally located\n configuration file, followed by the employee's local configuration file. For\n example, if the central configuration file is located in the directory\n `centralhub/`, then for user `jane`, the BOTO_PATH environment variable\n might be: \n\n ```\n BOTO_PATH =/centralhub/boto.cfg:home/jane/.boto\n ```\n\nWhen employees run gsutil, they will automatically use the configuration\nspecified in the central boto file. If necessary, the administrator can change\nthe proxy settings, parallel composite upload threshold, and other settings\nin the central configuration file and have the changes reflected for all\nemployees using the central configuration file."]]