How To
Summary
The HOSTALIASES environment variable can be used to specify a per-user host alias file.
Steps
If certain users need to be able to set up host name aliases, the HOSTALIASES environment variable can be used to acheive this.
First, create a file to hold the aliases. For this example, this file will be called ~/.hosts, so that it is located in the current user's home directory.
Populate this file with the alias and associated IP address:
mysystem 10.11.12.13
The hostname goes first, and must be a short host name. Fully qualified domain names are not allowed in this file.
Next, set the HOSTALIASES environment variable to point to the host alias file:
export HOSTALIASES=~/.hosts
After this is done, test by running:
ping mysystem
It will use the IP address that is set in the host alias file, and this will override any entry that exists in /etc/hosts.
Document Location
Worldwide
[{"Type":"MASTER","Line of Business":{"code":"LOB08","label":"Cognitive Systems"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG10","label":"AIX"},"ARM Category":[{"code":"a8m0z0000001fMuAAI","label":"AIX General Support"}],"ARM Case Number":"TS005615616","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Versions"}]
Was this topic helpful?
Document Information
More support for:
AIX
Component:
AIX General Support
Software version:
All Versions
Document number:
6462975
Modified date:
14 June 2021
UID
ibm16462975
Manage My Notification Subscriptions