The sign command is used to generate signed URLs for third-party users to access objects stored in buckets.

Note
  • The commands described in this topic apply to Linux. To use the commands in other systems, replace ./ossutil in the command with the actual executable program name. For example, you can use the help command in 32-bit Windows systems by running ossutil32.exe help.
  • For more information about object URLs, see How to obtain the URL of an uploaded object.

Command syntax

./ossutil sign oss://bucket/object [--timeout t] [--version-id versionId] [--trafic-limit limitSpeed] [--disable-encode-slash] [--payer requester]
  • --timeout: specifies the timeout period of the object URL. Unit: seconds. Valid values: non-negative integers. Default value: 60.
  • --trafic-limit: specifies the speed to access the object over HTTP. Unit: bit/s. Valid values: 100 KB/s to 100 MB/s. Default value: 0. 0 indicates that the maximum access speed is unlimited.

Examples

  • Generate an object URL that has a default timeout period of 60 seconds
    ./ossutil sign oss://bucket/path/object                       
  • Generate an object URL with a specified timeout period of 3600 seconds
    ./ossutil sign oss://bucket/path/object --timeout 3600
  • Generate an object URL with the download speed of 1 MB/s
    ./ossutil sign oss://bucket/path/object --trafic-limit 8388608
    Note Formula for unit conversion: 1 MB = 1,024 KB = 1,048,576 bytes = 8,388,608 bits
  • Generate a URL for a specified version of an object in a versioning-enabled bucket
    ./ossutil sign oss://bucket1/test.jpg --timeout 3600 --version-id  CAEQARiBgID8rumR2hYiIGUyOTAyZGY2MzU5MjQ5ZjlhYzQzZjNlYTAyZDE3MDRk
    To use the --version-id option, you must run the ls --all-versions command to query all available versions of the object.
    Note The --version-id option can be used only for objects in versioning-enabled buckets. For more information about the command that is used to enable versioning on a bucket, see bucket-versioning.
  • Generate an object URL for a specified object in a bucket with pay-by-requester enabled
    ./ossutil sign oss://bucket1/test.jpg --payer requester
    The account that generates the object URL pays for the fees for access from this URL.

Common options

The following table describes the options that you can add to the sign command.
Option Description
--timeout Specifies the timeout period of the object URL. Unit: seconds. Valid values: non-negative integers. Default value: 60.
--encoding-type Specifies the encoding type of the object name. If this option is specified, this value must be url. If this option is not specified, the object name is not encoded. Bucket names cannot be URL-encoded.
--loglevel Specifies the log level. The default value is null, which indicates that no log files are generated. Valid values:
  • info: generates prompt logs.
  • debug: generates detailed logs that contain corresponding HTTP request and response information.
--version-id Specifies the version ID of an object in a versioning-enabled bucket.
--trafic-limit Specifies the speed to access the object over HTTP. Unit: bit/s. Valid values: 100 KB/s to 100 MB/s. Default value: 0. 0 indicates that the maximum access speed is unlimited.
--disable-encode-slash Specifies that forward slashes (/) in the URL path are not encoded.
--payer requester Specifies the payer of the request. If pay-by-requester is enabled, you can set this option to requester.
Note For more information about common options, see View all supported options.