Portal Home > Knowledgebase > VMware Knowledge Base > Editing configuration files in VMware ESXi and ESX

Editing configuration files in VMware ESXi and ESX

Purpose

This article provides steps to edit files in VMware ESX and VMware ESXi.

Resolution

Datastore Browser

 
This section is applicable to all versions of VMware ESX and ESXi.
 
To download, edit and upload files to a datastore using the Datastore Browser:
  1. Open the vSphere Client and connect to the vCenter, ESX or ESXi machine using appropriate administrator-level credentials.
  2. Select an ESXi or ESX host that can access the datastore containing the files you want to edit.
  3. Click the Configuration tab > Storage.
  4. Right-click on the datastore and click Browse Datastore.
  5. In the left pane, navigate to the directory that contains the files.
  6. In the right pane, right-click on the file you wish to edit and click Download.
  7. Download the file and make note of its location.
  8. Open a preferred text editor. For more information about preferred editors, see Preferred Editors in this article.
  9. Open the downloaded file, edit it, and save the file.
  10. Return to the vSphere Client.
  11. Right-click on the original file and click Rename.
  12. Add a .bak extension to the file name. This step is optional but ensures that any changes can be reverted easily.
  13. Identify the folder in the left pane where you want to upload the modified file.
  14. Click the upload icon in the toolbox. The icon is a cylinder with a green arrow pointing up.
  15. Click Upload File.
  16. Navigate to and click the file you just modified.
  17. Click Open.
  18. A warning appears concerning file naming and the potential to overwrite files. Read the warning and click Yes.

vSphere Management Assistant and vSphere Command-Line Interface

This section is applicable to VMware ESX 3.5 Update 2 and later.
 
To download, edit and upload files to a datastore using the vifs utility:
  1. Open a console to your vSphere Management Assistant (vMA) appliance or a vSphere Command-Line Interface (CLI).
  2. Download the file you wish to edit by executing:

    vifs.pl  --get '[/' /
     
    Where:
    •  specify the host that has access to the datastore or vCenter and the username and password of an Administrator account.
    •  is the name of the datastore that contains the file you wish to edit.
    •  is the path within the datastore that contains the file.
    •  is the name of the file you wish to edit.
    •  is the path where you will download the file to. Make note of this location for future steps.

      For more information and examples about the vifs utility, see
       Performing File System Operations with vifsin the vSphere CLI documentation.
       
  3. Modify the file as required using the vMA or transfer it to another system for modification. If you are using the vCLI, proceed to the following step.
  4. Open a preferred text editor. For more information about preferred editors, see Preferred Editors in this article.
  5. Open the downloaded file, modify it as required, and save the file.
  6. Return to the vMA appliance console or vSphere CLI.
  7. Make a backup copy of the original by executing:

    vifs.pl  --move '[/' '[] /.bak' 
     
    Where:
    •  specify the host that has access to the datastore or vCenter and the username and password of an Administrator account.
    •  is the name of the datastore that contains the file you wish to edit. For our purposes, both values should be the same.
    •  is the path within the datastore that contains the file. For our purposes, both  values should be the same.
    •  is the name of the file you wish to edit. For our purposes, the second  value should include a .bak extension to indicate a backup copy.

      Caution: Omitting the additional .bak extension to the destination file name will result in overwriting your original file.

      For more information and examples about the vifs utility, see Performing File System Operations with vifssection of the vSphere CLI documentation
      .

  8. Upload the modified file to the original location by executing:

    vifs.pl  --put / '[/'  

    Where:
    •  specify the host that has access to the datastore or vCenter and the username and password of an Administrator account.
    •  is the name of the datastore that contains the file you wish to edit.
    •  is the path within the datastore that contains the file.
    •  is the name of the file you wish to edit.
    •  is the path where you will download the file to. Make note of this location for future steps.

      For more information and examples about the vifs utility, see Performing File System Operations with vifssection of the vSphere CLI documentation
      .

VMware ESXi or ESX Terminal

This section applies to VMware ESXi and ESX 4.1 and earlier.
 
To edit files using the VMware ESX Service Console or VMware ESXi Technical Support Mode:
  1. Log into the VMware ESX host as the root user.
    • For more information on VMware ESX Service Console, see Unable to connect to an ESX host using Secure Shell (SSH) (1003807).
    • For more information on VMware ESXi Technical Support Mode, see Tech Support Mode for Emergency Support (1003677).
       
  2. Make a backup copy of the file you wish to edit by executing:

    cp / /.bak
     
    Where:
    •  is the full path of the file.
    •  is the name of the file you wish to edit.

       
      Note: The second parameter in the cp command should have a filename with the .bak extension to indicate that it is a backup copy.

  3. Edit the file by executing:

    /

    Where:
    •  is your preferred editor. For more information about preferred editors, see Preferred Editors in this article.
    •  is the full path to the file.
    •  is the name of the file you wish to edit.

  4. If prompted to overwrite, ensure that you have made a backup copy and type y. Press Enter to commit your changes. 

Preferred Editors

There are different editors to choose from, depending on your running platform. This is non-exhaustive list of editors available in different platforms:
  • VMware ESX includes the open source terminal-based editors nano and vi. For more information, see the vi man pages or the nano man pages.
  • VMware ESXi includes the open source terminal-based editor vi. For more information, see the vi man pages.
  • Windows-based machines include basic text editors such as Notepad and Wordpad. If you are using either of these text editors, you must ensure that you are saving files in their original format and encoding.
Notes:
  • The editors available in the shell (vi or nano) are meant for troubleshooting purposes only and must be used only when directed by VMware. The vSphere Client, vCLI, and PowerCLI should be the primary method of propagating changes to your ESX/ESXi host.
  • Notepad saves documents as ANSI text which may not be the same file format as the files downloaded from a VMware ESX or ESXi host. For more information, see Using different language formats in Notepad from Microsoft's Windows XP Professional Product Documentation.
 
Based on VMware KB 1017022

Also Read

Language: