domainname
Display or set network domain name
SYNOPSIS
domainname [-v] [-F file] [newdomain]
PARAMETERS
-v
Verbose mode; displays more information about the operation.
-F file
Read the domain name from the specified file.
newdomain
Sets the NIS domain name to newdomain. Requires root privileges.
DESCRIPTION
The domainname command is used to display or set the system's domain name. This command is primarily intended for NIS (Network Information Service) domains. It's important to note that the domain name set with this command is typically used for NIS authentication and might not directly correspond to DNS domain names. When executed without arguments, domainname displays the current NIS domain name. When used with a single argument, it attempts to set the NIS domain name to that argument. Setting the domain name often requires root privileges.
Modern systems often rely on DNS for domain name resolution, making the domainname command less commonly used. However, it remains relevant in environments heavily utilizing NIS. Be aware that changing the domain name can impact network services relying on NIS and may require system restarts or service refreshes to fully propagate the changes.
CAVEATS
Setting the domain name with domainname may not be persistent across reboots. You might need to configure the domain name in a startup script or configuration file for it to be automatically set. The impact on network services can vary, so caution is advised.
This command is becoming obsolete as DNS is more common.
SECURITY CONSIDERATIONS
Setting the domainname requires root privileges due to its potential impact on system-wide network services. Ensure appropriate security measures are in place to prevent unauthorized modification of the domain name.
NIS INTEGRATION
The domainname command is tightly coupled with NIS. If NIS is not configured or is not functioning correctly, the domainname command might not behave as expected. Verify that NIS is properly configured before relying on domainname.
HISTORY
The domainname command originated in BSD Unix and was subsequently adopted into other Unix-like operating systems, including Linux. Its primary purpose was to manage NIS domains, a service popular for centralizing user authentication and network information in older Unix environments. As DNS became more prevalent, the reliance on domainname for setting general domain names decreased, though it remains relevant in systems using NIS.
SEE ALSO
hostname(1), nisdomainname(1), dnsdomainname(1)