Situatie
A hostname in Kali Linux (or any Linux system) is a unique label used to identify a device on a network. It allows the machine to be recognized and accessed via a human-readable name instead of an IP address.
Uses of a hostname:
- Identifies your machine on a network.
- Facilitates network communications.
- Displays in the terminal prompt to show the active machine.
Solutie
Pasi de urmat
Using the hostnamectl Command
Step 1: Open a Terminal
Keyboard shortcut “Ctrl + ALT + T” to open the terminal.
Step 2: Check Current Hostname
Use ‘hostnamectl’ to view the current hostname and gather information about the system’s configuration.
hostnamectl
Step 3: Change Hostname
Execute the command sudo hostnamectl set-hostname newhostname to set the new desired hostname. Replace “newhostname” with the actual hostname you want to assign to your system.
sudo hostnamectl set-hostname newhostname
Step 4: Apply Changes & Verify
Make sure that changes take effect by restarting the hostname service using the command ‘sudo systemctl restart systemd-hostnamed’. This step is important to make the system recognize and apply the new hostname.
sudo systemctl restart systemd-hostnamed
Confirm the update by checking the hostname again with the command ‘hostnamectl’. This step is necessary to verify that the changes were successfully implemented and that the new hostname is now in effect.
hostnamectl
Leave A Comment?