您可以通過config命令建立設定檔,用於儲存配置項和訪問憑證。config命令分為互動式命令和非互動式命令,您可以按需進行設定。
建立設定檔
ossutil config
該命令為互動式命令,用於快速設定預設參數,即在[default]節裡設定長期憑證和地區。
ossutil config
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 Access Key ID [None]:
Please enter Access Key Secret [None]:
Please enter Region [cn-hangzhou]:
設定和查看配置設定
設定配置設定
ossutil config set
該命令為非互動式命令,設定憑證或配置設定。通過--config-file指定設定檔路徑,通過--profile指定 [profile xxx]。
例如,以下命令設定myconfig檔案中,dev節的region參數。
ossutil config set region cn-hangzhou --config-file myconfig --profile dev
要刪除某個設定,請使用Null 字元串作為值,或在文字編輯器中手動從刪除該設定。
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]: