The domainname
command is used to display or set the system’s NIS (Network Information Service) domain name. NIS is a client-server directory service protocol used to distribute system configuration files, such as user and group information, across a network. The domain name is used to identify the NIS domain to which the system belongs.
Overview
To display the current NIS domain name, simply run the command domainname
without any arguments:
$ domainname
example.com
This will output the current domain name, which in this example is example.com
.
To set a new NIS domain name, use the domainname
command followed by the desired domain name:
$ domainname newdomain.com
This will set the new domain name to newdomain.com
.
Options
The domainname
command has the following options:
Option | Description |
---|---|
-f , --fqdn |
Display the fully qualified domain name |
-y , --yp |
Display the NIS domain name |
-h , --help |
Display help information and exit |
-V , --version |
Display version information and exit |
Troubleshooting Tips
If you are unable to set the NIS domain name, you may need to check that the NIS service is running and that the system is configured to use it. You can check the status of the NIS service with the following command:
$ systemctl status ypbind.service
If the service is not running, you can start it with the following command:
$ systemctl start ypbind.service
Notes
- The domain name is stored in the
/etc/defaultdomain
file. - The
domainname
command is not used to set the DNS domain name, which is set using thehostname
command.