이 콘텐츠는 선택한 언어로 제공되지 않습니다.

1.4. Set Environment Variables Using the OpenStack RC File


To set the required environment variables for the OpenStack command-line clients, you must create an environment file called an OpenStack rc file, or openrc.sh file. If your OpenStack installation provides it, you can download the file from the OpenStack dashboard as an administrative user or any other user. This project-specific environment file contains the credentials that all OpenStack services use.
When you source the file, environment variables are set for your current shell. The variables enable the OpenStack client commands to communicate with the OpenStack services that run in the cloud.
Note
Defining environment variables using an environment file is not a common practice on Microsoft Windows. Environment variables are usually defined in the Advanced tab of the System Properties dialog box.

1.4.1. Download and Source the OpenStack RC File

  1. Log in to the OpenStack dashboard, choose the project for which you want to download the OpenStack RC file, and click Access & Security.
  2. On the API Access tab, click Download OpenStack RC File and save the file. The filename will be of the form PROJECT-openrc.sh where PROJECT is the name of the project for which you downloaded the file.
  3. Copy the PROJECT-openrc.sh file to the computer from which you want to run OpenStack commands.
    For example, copy the file to the computer from which you want to upload an image with a glance client command.
  4. On any shell from which you want to run OpenStack commands, source the PROJECT-openrc.sh file for the respective project.
    In the following example, the demo-openrc.sh file is sourced for the demo project:
    $ source demo-openrc.sh
    Copy to Clipboard Toggle word wrap
  5. When you are prompted for an OpenStack password, enter the password for the user who downloaded the PROJECT-openrc.sh file.

1.4.2. Create and Source the OpenStack RC File

Alternatively, you can create the PROJECT-openrc.sh file from scratch, if for some reason you cannot download the file from the dashboard.
  1. In a text editor, create a file named PROJECT-openrc.sh file and add the following authentication information:
    export OS_USERNAME=username
    export OS_PASSWORD=password
    export OS_PROJECT_NAME=projectName
    export OS_AUTH_URL=https://identityHost:portNumber/v2.0
    # The following lines can be omitted
    export OS_TENANT_ID=tenantIDString
    export OS_REGION_NAME=regionName
    Copy to Clipboard Toggle word wrap
    The following example shows the information for a project called admin, where the OS username is also admin, and the identity host is located at controller.
    export OS_USERNAME=admin
    export OS_PASSWORD=ADMIN_PASS
    export OS_PROJECT_NAME=admin
    export OS_AUTH_URL=http://controller:35357/v2.0
    Copy to Clipboard Toggle word wrap
  2. On any shell from which you want to run OpenStack commands, source the PROJECT-openrc.sh file for the respective project. In this example, you source the admin-openrc.sh file for the admin project:
    $ source admin-openrc.sh
    Copy to Clipboard Toggle word wrap
Note
You are not prompted for the password with this method. The password lives in clear text format in the PROJECT-openrc.sh file. Restrict the permissions on this file to avoid security problems. You can also remove the OS_PASSWORD variable from the file, and use the --password parameter with OpenStack client commands instead.

1.4.3. Override Environment Variable Values

When you run OpenStack client commands, you can override some environment variable settings by using the options that are listed at the end of the help output of the various client commands. For example, you can override the OS_PASSWORD setting in the PROJECT-openrc.sh file by specifying a password on a keystone command, as follows:
$ keystone --os-password PASSWORD service-list
Copy to Clipboard Toggle word wrap
Where PASSWORD is your password.
맨 위로 이동
Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다. 최신 업데이트를 확인하세요.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

Theme

© 2026 Red Hat