赛尔校园公共服务平台 Logo
平台使用
阿里云
百度云
移动云
智算服务
教育生态
登录 →
赛尔校园公共服务平台 Logo
平台使用 阿里云 百度云 移动云 智算服务 教育生态
登录
  1. 首页
  2. 阿里云
  3. 对象存储
  4. 开发参考
  5. 常用工具
  6. 命令行工具ossutil 2.0
  7. ossutil命令
  8. 辅助命令
  9. config(管理配置文件)

config(管理配置文件)

  • 辅助命令
  • 发布于 2025-04-21
  • 0 次阅读
文档编辑
文档编辑

您可以通过config命令创建配置文件,用于存储配置项和访问凭证。config命令分为交互式命令和非交互式命令,您可以按需进行设置。

创建配置文件

  1. 输入配置命令。

    ossutil config
  2. 根据提示设置配置文件路径。您可以直接回车使用默认的配置文件路径。

    以下提示以Linux系统为例。

    Please enter the config file name,the file name can include path(default /root/.ossutilconfig, carriage return will use the default file. If you specified this option to other file, you should specify --config-file option to the file when you use other commands):
  3. 根据提示分别设置AccessKey ID、AccessKey Secret、地域ID信息。

    1. 输入您创建的AccessKey ID。

      Please enter Access Key ID [****************id]:LTAI****************
    2. 输入您创建的AccessKey Secret。

      Please enter Access Key Secret [****************sk]:R6vg*********************
    3. 输入您的OSS的数据中心所在的地域ID,如无任何输入,默认值为cn-hangzhou。

      Please enter Region [cn-hangzhou]: cn-hangzhou
    4. 输入您的OSS的数据中心的Endpoint,如果您不需要自定义 Endpoint,可以直接按回车跳过该参数的配置。

      在上一步配置完地域信息后,将默认使用该地域 ID 对应的外网 Endpoint。例如,如果您设置的 region-id 为 cn-hangzhou,默认使用的外网 Endpoint 是 https://oss-cn-hangzhou.aliyuncs.com。

      如果您需要自定义 OSS 数据中心所在地域的 Endpoint,请输入您的 Endpoint 信息。例如,如果您希望通过与OSS同地域的其他阿里云产品访问OSS,请使用内网Endpoint如https://oss-cn-hangzhou-internal.aliyuncs.com

      Please enter Endpoint (optional, use public endpoint by default) [None]: https://oss-cn-hangzhou-internal.aliyuncs.com

    参数说明如下:

    参数

    是否必填

    说明

    accessKeyID

    是

    填写账号的AccessKey,AccessKey的获取方式,请参见创建AccessKey。

    使用ROS脚本快速创建有OSS管理权限的RAM用户AccessKey

    在资源编排ROS控制台的创建资源栈页面的安全确认下,勾选确认,然后单击创建。

    1.png

    创建完成后,在输出中,复制创建的AccessKey。

    1.png

    accessKeySecret

    是

    Region

    是

    填写Bucket所在的地域ID,本文以杭州地域为例,设置为cn-hangzhou,其他地域的ID参见OSS地域和访问域名。

    endpoint

    否

    填写Bucket所在地域的Endpoint。若未手动设置Endpoint,Region将自动生成对应的外网Endpoint,内网需显式指定。例如,本示例使用华东1(杭州)外网Endpoint,设置为https://oss-cn-hangzhou.aliyuncs.com。

    如果您希望通过与OSS同地域的其他阿里云产品访问OSS,请使用内网Endpoint,设置为https://oss-cn-hangzhou-internal.aliyuncs.com。

    关于各地域Endpoint的更多信息,请参见OSS地域和访问域名。

设置和查看配置设置

设置配置设置

ossutil config set

该命令为非交互式命令,设置凭证或配置设置。通过--config-file指定配置文件路径,通过--profile指定 [profile xxx]。

例如,以下命令用于设置myconfig文件中,dev节的region参数。

ossutil config set region cn-hangzhou --config-file myconfig --profile dev

要删除某个设置,请使用空字符串作为值,或在文本编辑器中手动删除该设置。

ossutil config set region "" --config-file myconfig --profile dev

获取配置设置

ossutil config get

该命令为非交互式命令,用于查看凭证或配置设置。通过--config-file指定配置文件路径,通过--profile指定节名。例如,用以下命令查看myconfig文件中,dev节的region参数。

ossutil config get region --config-file myconfig --profile dev

列出所有配置名称

该命令为非交互式命令,列出所有节的名称。

ossutil config list-profiles

快速创建或配置访问凭证

ossutil config credential

该命令为交互式命令,用于快速创建访问凭证设置。其中AK/SK/Token三个参数会涉及用户是否需要加密。

ossutil config credential
The command creates a config file and stores configuration settings and credentials.

Please enter the config file name,the file name can include path(default "C:\Users\issuser\.ossutilconfig", carriage return will use the default file. If you specified this option to other file, you should specify --config-file option to the file when you use other commands):

No config file entered, will use the default config file "C:\Users\issuser\.ossutilconfig"For the following settings, carriage return means skip the configuration.
Please enter profile:
Please enter authenticate mode, supports RamRoleArn,EcsRamRole,Process,Uri,OIDCRoleArn,AK,StsToken:
Do you need to encryt access key id and access key secret (y or N)
Please enter Access Key ID [None]:
Please enter Access Key Secret [None]:

相关文章

help(获取帮助信息) 2025-04-21 17:22

本文为您介绍如何获取ossutil命令的帮助信息。 内置的帮助命令 在使用ossutil时,您可以在命令名称末尾输入-h或者--help,以获取任何命令的帮助信息。您可以使用ossutil [topic]获取特定主题的帮助信息。命令示例如下:

config(管理配置文件) 2025-04-21 17:22

您可以通过config命令创建配置文件,用于存储配置项和访问凭证。config命令分为交互式命令和非交互式命令,您可以按需进行设置。 创建

update(ossutil版本升级) 2025-04-21 17:22

update命令用于将ossutil升级至最新版本。 命令格式

version(显示版本信息) 2025-04-21 17:22

version命令用于显示ossutil版本信息。 命令格式 ossutil version [flags]

probe(探测状态) 2025-04-21 17:22

probe命令是针对OSS访问的探测命令,可用于排查本地与OSS之间的网络状态、上传下载带宽、本地符号链接(软链接)状态等。 注意事项 要探测上传带宽,您必须具有

目录
Copyright © 2025 your company All Rights Reserved. Powered by 赛尔网络.
京ICP备14022346号-15
gongan beian 京公网安备11010802041014号