Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
0
votes
2
answers
1891
views
Browse by hostname from internet browser
I can browse my server site using ip:8080 which is inside my home network.But I am not able to browse using hostname:8080 I do not have dns server. I have edited /etc/hosts file to include hostname and ip. I can ping using hostname. 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.loc...
I can browse my server site using
ip:8080
which is inside my home network.But I am not able to browse using
hostname:8080
I do not have dns server. I have edited /etc/hosts file to include hostname and ip. I can ping using hostname.
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
10.16.2.12 apple.myserver.com
10.16.2.22 ball.myserver.com
10.16.2.20 cat.myserver.com
10.16.2.19 dog.myserver.com
10.16.2.18 elep.myserver.com
Similar Issue Here .
kinkajou
(745 rep)
Nov 27, 2015, 11:21 AM
• Last activity: Jul 3, 2025, 10:18 AM
-1
votes
1
answers
66
views
Is there an equivalent cli command in macos for hostnamectl?
Is there an equivalent on MacOS to the Linux `hostnamectl` command?
Is there an equivalent on MacOS to the Linux
hostnamectl
command?
bobbycheetah
(19 rep)
Jun 17, 2025, 08:05 PM
• Last activity: Jun 18, 2025, 07:41 AM
1
votes
1
answers
52
views
show just the “machine name” (hostname) in neofetch
When I run neofetch, I get the first line containing : ``` fauve@katioucha ``` I can silent it by `neofetch --disable title`, it’s fine. But my goal is to hide the user and keep the hostname. I found [here](https://github.com/dylanaraps/neofetch/wiki/Customizing-Info#display-the-current-weather) how...
When I run neofetch, I get the first line containing :
fauve@katioucha
I can silent it by neofetch --disable title
, it’s fine. But my goal is to hide the user and keep the hostname.
I found [here](https://github.com/dylanaraps/neofetch/wiki/Customizing-Info#display-the-current-weather) how to configure the infonames to show, but theire is no infoname for the “machine name”. host
exist but in the neofetch terminology host
refer to the model of the machine not to the system name.
Also title
refer to @
but I didn’t found a way to just display machine name.
So, how can I display in one line just the machine name in neofetch?
fauve
(1529 rep)
Jun 11, 2025, 08:08 AM
• Last activity: Jun 11, 2025, 12:42 PM
3
votes
1
answers
2055
views
Value of /proc/sys/kernel/hostname
I've set computer hostname in `/etc/hostname` a while ago (also there are record in `/etc/hosts`). Everything worked fine, but recently I've noticed that value of `hostname` (and `/proc/sys/kernel/hostname`) changed (to hostname of neighbour computer), although I haven't touched anything related. Va...
I've set computer hostname in
/etc/hostname
a while ago (also there are record in /etc/hosts
). Everything worked fine, but recently I've noticed that value of hostname
(and /proc/sys/kernel/hostname
) changed (to hostname of neighbour computer), although I haven't touched anything related. Value of /etc/hostname
remains correct. Which mechanism may cause such change?
There are similar problem description , but it doesn't contains any solution.
valodzka
(405 rep)
Nov 22, 2013, 01:33 PM
• Last activity: Apr 9, 2025, 03:04 AM
1
votes
2
answers
4999
views
Installing systemd-resolved kills dns lookup
**Update** After uninstalling and re-installing `systemd-resolved`, the issue seems to have righted itself. I do not understand why, but I did notice that the `/etc/resolv.conf` does not get modified after installing `systemd-resolved` for the second time, where it was modified the first time I inst...
**Update**
After uninstalling and re-installing
systemd-resolved
, the issue seems to have righted itself. I do not understand why, but I did notice that the /etc/resolv.conf
does not get modified after installing systemd-resolved
for the second time, where it was modified the first time I installed the package.
**Problem:**
I'm trying to follow the Home-Assistant supervised installer instructions here on my Orange Pi Zero running Debian. This was set up from a netboot image. After installing the systemd-resolved
package, the system can no longer look up website addresses. Uninstalling the package resolves the issue. This is the error:
Temporary failure resolving 'deb.debian.org'
**Observations:**
This did not happen when using an Armbian image for my unit, but Home-Assistant does not support Armbian, so I am trying with Debian instead.
I can't ping web addresses (or .locals on my network), but I can ping IP addresses.
**Working vs expected working:**
Expected (working before installing systemd-resolved
)
jodie@orangePiZero:~$ wget -O homeassistant-supervised.deb https://github.com/home-assistant/supervised-installer/releases/latest/download/homeassistant-supervised.deb
--2023-11-22 00:00:49-- https://github.com/home-assistant/supervised-installer/releases/latest/download/homeassistant-supervised.deb
Resolving github.com (github.com)... 20.87.245.0
Connecting to github.com (github.com)|20.87.245.0|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://github.com/home-assistant/supervised-installer/releases/download/1.5.0/homeassistant-supervised.deb [following]
--2023-11-22 00:00:50-- https://github.com/home-assistant/supervised-installer/releases/download/1.5.0/homeassistant-supervised.deb
Reusing existing connection to github.com:443.
HTTP request sent, awaiting response... 302 Found
Location: https://objects.githubusercontent.com/github-production-release-asset-2e65be/183216119/905cc380-f350-4a95-ac33-a2749b7858fa?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20231121%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20231121T220050Z&X-Amz-Expires=300&X-Amz-Signature=21a10eb8987bbe62d3a2826be9ba66ed9476dbbe6015990ad0fb53b46db6224f&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=183216119&response-content-disposition=attachment%3B%20filename%3Dhomeassistant-supervised.deb&response-content-type=application%2Foctet-stream [following]
--2023-11-22 00:00:50-- https://objects.githubusercontent.com/github-production-release-asset-2e65be/183216119/905cc380-f350-4a95-ac33-a2749b7858fa?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20231121%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20231121T220050Z&X-Amz-Expires=300&X-Amz-Signature=21a10eb8987bbe62d3a2826be9ba66ed9476dbbe6015990ad0fb53b46db6224f&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=183216119&response-content-disposition=attachment%3B%20filename%3Dhomeassistant-supervised.deb&response-content-type=application%2Foctet-stream
Resolving objects.githubusercontent.com (objects.githubusercontent.com)... 185.199.108.133, 185.199.109.133, 185.199.110.133, ...
Connecting to objects.githubusercontent.com (objects.githubusercontent.com)|185.199.108.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 6504 (6.4K) [application/octet-stream]
Saving to: ‘homeassistant-supervised.deb’
homeassistant-supervised.d 100%[=======================================>] 6.35K --.-KB/s in 0.002s
2023-11-22 00:00:51 (2.50 MB/s) - ‘homeassistant-supervised.deb’ saved [6504/6504]
Not working:
jodie@orangePiZero:~$ wget -O homeassistant-supervised.deb https://github.com/home-assistant/supervised-installer/releases/latest/download/homeassistant-supervised.deb
--2023-11-22 17:11:35-- https://github.com/home-assistant/supervised-installer/releases/latest/download/homeassistant-supervised.deb
Resolving github.com (github.com)... failed: Temporary failure in name resolution.
wget: unable to resolve host address ‘github.com’
**Network setup:**
I have a tp-link home router set with a DHCP address reservation for this device's MAC address. It's on the same subnet as my other devices and does not specify a different DNS server. I can still ssh into the device (which is how I'm primarily setting it up)
**Question:**
Is there a configuration I need to set for DNS to work with systemd-resolved
?
**Requested info:**
Contents of /etc/resolv.conf
before installing systemd-resolved
:
nameserver 192.168.0.1
nameserver 0.0.0.0
Contents after first install:
# This is /run/systemd/resolve/stub-resolv.conf managed by man:systemd-resolved(8).
# Do not edit.
#
# This file might be symlinked as /etc/resolv.conf. If you're looking at
# /etc/resolv.conf and seeing this text, you have followed the symlink.
#
# This is a dynamic resolv.conf file for connecting local clients to the
# internal DNS stub resolver of systemd-resolved. This file lists all
# configured search domains.
#
# Run "resolvectl status" to see details about the uplink DNS servers
# currently in use.
#
# Third party programs should typically not access this file directly, but only
# through the symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a
# different way, replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.
nameserver 127.0.0.53
options edns0 trust-ad
search .
Contents after uninstall and re-install:
nameserver 192.168.0.1
nameserver 0.0.0.0
Contents of /etc/nsswitch.conf
before installing systemd-resolved
:
# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the glibc-doc-reference' and
info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.
passwd: files systemd
group: files systemd
shadow: files systemd
gshadow: files systemd
hosts: files dns
networks: files
protocols: db files
services: db files
ethers: db files
rpc: db files
netgroup: nis
Contents after first install of systemd-resolved
:
# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the glibc-doc-reference' and
info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.
passwd: files systemd
group: files systemd
shadow: files systemd
gshadow: files systemd
hosts: files resolve [!UNAVAIL=return] dns myhostname
networks: files
protocols: db files
services: db files
ethers: db files
rpc: db files
netgroup: nis
Contents after uninstall and re-install of systemd-resolved
# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the glibc-doc-reference' and
info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.
passwd: files systemd
group: files systemd
shadow: files systemd
gshadow: files systemd
hosts: files resolve [!UNAVAIL=return] dns myhostname
networks: files
protocols: db files
services: db files
ethers: db files
rpc: db files
netgroup: nis
**Other info**
This is the result of running resolvectl status
:
jodie@orangePiZero:~$ resolvectl status
Failed to get global data: Connection timed out
This is the output of systemctl status systemd-resolved
:
jodie@orangePiZero:~$ systemctl status systemd-resolved
● systemd-resolved.service - Network Name Resolution
Loaded: loaded (/lib/systemd/system/systemd-resolved.service; enabled; preset: enabled)
Active: active (running) since Tue 2023-11-21 23:09:21 SAST; 24min ago
Docs: man:systemd-resolved.service(8)
man:org.freedesktop.resolve1(5)
https://www.freedesktop.org/wiki/Software/systemd/writing-network-configuration-managers
https://www.freedesktop.org/wiki/Software/systemd/writing-resolver-clients
Main PID: 577 (systemd-resolve)
Status: "Processing requests..."
Tasks: 1 (limit: 1075)
Memory: 2.3M
CPU: 847ms
CGroup: /system.slice/systemd-resolved.service
└─577 /lib/systemd/systemd-resolved
user111395
(31 rep)
Nov 20, 2023, 09:12 PM
• Last activity: Apr 5, 2025, 09:10 AM
0
votes
0
answers
15
views
How to uses rsyslog with more than one hostname via Linux Namespaces?
I am trying to learn about UTS namespace. I want to write some log entries from both a parent namespace and a child UTS namespace. This is for demonstration purposes, so it doesn't matter if `rsyslog` writes to the same log file or separate log files for each namespace. The only thing that matters i...
I am trying to learn about UTS namespace. I want to write some log entries from both a parent namespace and a child UTS namespace. This is for demonstration purposes, so it doesn't matter if
rsyslog
writes to the same log file or separate log files for each namespace. The only thing that matters is that the child namespace writes logs with a different hostname from parent namespace. But I can't seem to preserve the two different hostnames.
Here is my latest attempt:
I have two SSH terminal windows opened both with the same user.
**Go to Terminal 1**
me@localhost: sudo unshare --uts /bin/bash
root@localhost: hostname api1
root@localhost: hostname
api1
root@localhost: rsyslogd -n -i /var/run/rsyslogd-child.pid -f /etc/rsyslog.conf &
root@localhost: logger foochild1
`
**Go to Terminal 2**
me@localhost: logger fooparent1
Now in my /var/log/syslog
, both entries were recorded with the hostname from the child namespace:
Mar 8 22:47:12 api1 root: foochild1
Mar 8 22:47:33 api1 me: fooparent1
Can someone suggest to me a way to write log files from different namespaces while also preserving the hostname of the respective namespaces?
learningtech
(631 rep)
Mar 8, 2025, 11:00 PM
7
votes
2
answers
1272
views
Why does Kubuntu refuse one-letter hostnames?
I see that Kubuntu refuses to create one-letter hostnames: > Your hostname is too short. Why? Is that a security issue, a potential name overlap concern, or something else? --- [![enter image description here][1]][1] [1]: https://i.sstatic.net/194Werk3.png
I see that Kubuntu refuses to create one-letter hostnames:
> Your hostname is too short.
Why? Is that a security issue, a potential name overlap concern, or something else?
---

Franck Dernoncourt
(5533 rep)
Jan 25, 2025, 11:40 PM
• Last activity: Jan 26, 2025, 11:37 AM
0
votes
1
answers
175
views
How to access an Angular App created on CentOs7 in a Windows 10 VM?
I created an angular app in CentOs7 and was able to open it in a web browser in my CentOs7 VM using http://localhost:4200/. I need to be able to access it my Windows 10 VM, but when I tried changing the IP, it still worked in Cent but gave me an error saying port 4200 is already in use. It doesn't w...
I created an angular app in CentOs7 and was able to open it in a web browser in my CentOs7 VM using http://localhost:4200/. I need to be able to access it my Windows 10 VM, but when I tried changing the IP, it still worked in Cent but gave me an error saying port 4200 is already in use. It doesn't work in Windows with either address. How do I configure this so it's accessible in my Windows VM?
Nudge
(3 rep)
May 1, 2020, 02:35 AM
• Last activity: Jan 21, 2025, 03:49 PM
1
votes
2
answers
765
views
Resolve Host's IP on VM
I have kind of tricky situation. I have monitoring tool where all my hosts and their VM's (with IP's and so on) are listed. But what I need is to resolve on which host(need it's ip or hostname) this monitoring tool is because tool does not list itself. I know that the main point of virtualization is...
I have kind of tricky situation. I have monitoring tool where all my hosts and their VM's (with IP's and so on) are listed. But what I need is to resolve on which host(need it's ip or hostname) this monitoring tool is because tool does not list itself. I know that the main point of virtualization is to not show that but maybe there is any way to get any info when connected to *VM* about it's ***host***?
Dambre
(111 rep)
Mar 10, 2015, 10:14 AM
• Last activity: Jan 18, 2025, 03:08 PM
0
votes
1
answers
89
views
Where is the HOSTNAME taken from?
In the last few days the server name in the prompt on our production server has changed from the correct myu3a01 to the incorrect icaris30, the name of an old server which is now used to address our backup NAS. We are running on Centos 6 (which we are working to replace). The /etc/hosts file, /etc/h...
In the last few days the server name in the prompt on our production server has changed from the correct myu3a01 to the incorrect icaris30, the name of an old server which is now used to address our backup NAS.
We are running on Centos 6 (which we are working to replace).
The /etc/hosts file, /etc/hostname file, /etc/sysconfig/network file all show the correct server name.
The ip address of icaris30 has been changed by the ISP recently, although I do not see any relevance of this.
The command hostname gives icaris30 and hostname -i gives its ip address. hostname -a gives the hosts file names for icaris30.
I am using ssh to access the server, which is the correct server, even though the prompt is incorrect.
How can I fix the displayed server name?
Where is it getting the incorrect name?
WarwickWr
(1 rep)
Dec 20, 2024, 04:03 AM
• Last activity: Jan 14, 2025, 02:55 PM
0
votes
1
answers
60
views
mDNS hostname from other device gets assigned local
I have a weird issue. I have an ESP32 embedded device running an mDNS server which I assign a hostname to. For the record, i've included this code for the ESP32 device below. When I ping this hostname from my Ubuntu PC on the same local network,this hostname becomes local and it is not actually ping...
I have a weird issue. I have an ESP32 embedded device running an mDNS server which I assign a hostname to. For the record, i've included this code for the ESP32 device below.
When I ping this hostname from my Ubuntu PC on the same local network,this hostname becomes local and it is not actually pinging the device. No matter what I change the hostname to on the esp device, this happens. In this case i've named it
audio-server
and I ping it as follows :
ping audio-server.local
PING audio-server.local (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.026 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.048 ms
64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.048 ms
64 bytes from localhost (127.0.0.1): icmp_seq=4 ttl=64 time=0.044 ms
What exactly is going on here?
static void mdns_delegate_hostname(void)
{
esp_err_t err = ESP_OK;
char *delegated_hostname = "audio-server";
esp_netif_t *intf = esp_netif_get_default_netif();;
while (intf == NULL)
{
ESP_LOGE(TAG, "ERROR ! netif is NULL");
intf = esp_netif_get_default_netif();
sleep(2);
}
mdns_ip_addr_t addr4, addr6;
addr4.addr.type = ESP_IPADDR_TYPE_V4;
esp_netif_ip_info_t info;
esp_netif_get_ip_info(intf, &info);
ESP_LOGI(TAG, "IP Address of device is : " IPSTR "\n", IP2STR(&info.ip));
addr4.addr.u_addr.ip4 = info.ip;
addr6.addr.type = ESP_IPADDR_TYPE_V6;
esp_netif_get_ip6_linklocal(intf, &addr6.addr.u_addr.ip6);
addr4.next = &addr6;
addr6.next = NULL;
ESP_LOGI(TAG, "Setting delegated hostname to %s\n", delegated_hostname);
err = mdns_delegate_hostname_add(delegated_hostname, &addr4);
if (err != ESP_OK)
{
ESP_LOGE(TAG, "ERROR Setting delegated hostname to %s\n", delegated_hostname);
return;
}
err = mdns_service_add_for_host(NULL, "_http", "_tcp", delegated_hostname, 80, NULL, 0);
if (err != ESP_OK)
{
ESP_LOGE(TAG, "ERROR adding service for host %s\n", delegated_hostname);
}
}
Engineer999
(1233 rep)
Jan 4, 2025, 08:08 PM
• Last activity: Jan 4, 2025, 10:48 PM
5
votes
2
answers
1494
views
zsh ssh autocomplete Host instead of Hostname from ~/.ssh/hosts
Is there a way I can massage my `~/.zshrc` to make the ssh auto-completion autocomplete for the `Host`, not the `Hostname`? I have an entry in my `~/.ssh/config` that looks like this: Host staging-rfc staging User crmpicco Hostname staging.rfc.crmpicco.co.uk If I type `ssh sta[TAB]` then it pre-fill...
Is there a way I can massage my
~/.zshrc
to make the ssh auto-completion autocomplete for the Host
, not the Hostname
?
I have an entry in my ~/.ssh/config
that looks like this:
Host staging-rfc staging
User crmpicco
Hostname staging.rfc.crmpicco.co.uk
If I type ssh sta[TAB]
then it pre-fills the full hostname of staging.rfc.crmpicco.co.uk
, which gives me a permission denied error - presumably because it's trying to login with my terminal user and not "crmpicco".
rfcpicco1872@staging.rfc.crmpicco.co.uk: Permission denied (publickey).
My ~/.zshrc
:
# Highlight the current autocomplete option
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
# Better SSH/Rsync/SCP Autocomplete
zstyle ':completion:*:(scp|rsync):*' tag-order ' hosts:-ipaddr:ip\ address hosts:-host:host files'
zstyle ':completion:*:(ssh|scp|rsync):*:hosts-host' ignored-patterns '*(.|:)*' loopback ip6-loopback localhost ip6-localhost broadcasthost
zstyle ':completion:*:(ssh|scp|rsync):*:hosts-ipaddr' ignored-patterns '^(...|(|::)([[:xdigit:].]##:(#c,2))##(|%*))' '127.0.0.' '255.255.255.255' '::1' 'fe80::*'
# Allow for autocomplete to be case insensitive
zstyle ':completion:*' matcher-list '' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' \
'+l:|?=** r:|?=**'
# Initialize the autocompletion
autoload -Uz compinit && compinit -i
crmpicco
(579 rep)
Nov 13, 2019, 08:22 AM
• Last activity: Dec 20, 2024, 03:22 AM
1
votes
1
answers
465
views
What exactly does "sudo hostnamectl set-hostname NEW_HOSTNAME" change?
Just want to understand exactly what `sudo hostnamectl set-hostname NEW_HOSTNAME` is doing. Surely it does something other than changing the value inside `/etc/hostname`?
Just want to understand exactly what
sudo hostnamectl set-hostname NEW_HOSTNAME
is doing.
Surely it does something other than changing the value inside /etc/hostname
?
johnnyApplePRNG
(11 rep)
Aug 29, 2021, 04:17 PM
• Last activity: Dec 3, 2024, 10:59 AM
0
votes
2
answers
122
views
Device name of a Linux system required for identifying it as an "allowed device" on a WiFi hotspot?
I want to add a Linux system to the white list of a WiFi mobile hotspot running on Android. Doing `hostnamectl` returns, amongst other information, a `Static hostname`, an `Icon name`, a `Machine ID`, and a `Boot ID`. Which of these is the right one? I got the MAC address of the `wlan0` interface by...
I want to add a Linux system to the white list of a WiFi mobile hotspot running on Android. Doing
hostnamectl
returns, amongst other information, a Static hostname
, an Icon name
, a Machine ID
, and a Boot ID
. Which of these is the right one?
I got the MAC address of the wlan0
interface by doing ip addr
in the terminal and added it, together with the Static hostname
, to the white list, but the connection fails. Signal strength is very good and the WPA2 password is correct.
PS.: On a Windows 10 machine, you get the corresponding name by doing hostname
in the command line or looking it up in Settings > System > About
under "Device name".
user658623
Oct 12, 2024, 04:17 PM
• Last activity: Oct 14, 2024, 07:37 PM
10
votes
2
answers
32033
views
How do I fix my problem with hostnamectl command. It cannot connect to dbus
I am running Debian 9.4. `hostname` works. $ sudo strace -f hostnamectl ...snipped... connect(3, {sa_family=AF_UNIX, sun_path="/var/run/dbus/system_bus_socket"}, 33) = -1 ENOENT (No such file or directory) ... Failed to create bus connection: No such file or directory UPDATE: here are more informati...
I am running Debian 9.4.
hostname
works.
$ sudo strace -f hostnamectl
...snipped...
connect(3, {sa_family=AF_UNIX, sun_path="/var/run/dbus/system_bus_socket"}, 33) = -1 ENOENT (No such file or directory)
...
Failed to create bus connection: No such file or directory
UPDATE: here are more information:
$ sudo systemctl status dbus.service dbus.socket
Unit dbus.service could not be found.
Unit dbus.socket could not be found.
$ ps -p 1
PID TTY TIME CMD
1 ? 00:00:47 systemd
$ sudo systemctl list-unit-files --state=running
0 unit files listed.
$ sudo systemctl list-unit-files --state=enabled
...snipped...
26 unit files listed.
Bon Ami
(933 rep)
Sep 7, 2018, 08:21 PM
• Last activity: Sep 24, 2024, 08:30 PM
3
votes
2
answers
959
views
NetBSD 7.0.2 not honoring hostname setting when using DHCP
I've recently installed NetBSD 7.0.2, and I'm having trouble setting my hostname right. I'm using DHCP, so I got `dhclient=YES` in my `/etc/rc.conf`. Now, the documentation says, that there are several ways of setting the hostname. The prefered one is to put the hostname into a file. So `/etc/myname...
I've recently installed NetBSD 7.0.2, and I'm having trouble setting my hostname right.
I'm using DHCP, so I got
dhclient=YES
in my /etc/rc.conf
.
Now, the documentation says, that there are several ways of setting the hostname.
The prefered one is to put the hostname into a file. So /etc/myname
contains a single line with the fully qualified domain name, etc.
This didn't help so I also added hostname=
into /etc/rc.conf
, but it still doesn't honor my hostname settings.
This didn't help either, so I ended up editing /etc/defaults/rc.conf
and set the appropriate settings there.
At this point I've run out of ideas. It's still not honering my selection, instead selecting a hostname for me, which is the name of my router plus a number.
polemon
(11921 rep)
Jan 22, 2017, 05:10 AM
• Last activity: Aug 3, 2024, 05:54 PM
31
votes
4
answers
116326
views
How to set the fully qualified hostname on CentOS 7.0?
How do I set the fully qualified hostname on CentOS 7.0? I have seen a few posts online for example using: $ sudo hostnamectl set-hostname nodename.domainname However, running domainname returns nothing: $ domainname (none) Also: $ hostname nodename.domainname However, $ hostname -f hostname: Name o...
How do I set the fully qualified hostname on CentOS 7.0?
I have seen a few posts online for example using:
$ sudo hostnamectl set-hostname nodename.domainname
However, running domainname returns nothing:
$ domainname
(none)
Also:
$ hostname
nodename.domainname
However,
$ hostname -f
hostname: Name or service not known
$ hostname -d
hostname: Name or service not known
Some debug output:
$ cat /etc/hostname
nodename.domainname
$ grep ^hosts /etc/nsswitch.conf
hosts: files dns
Chris Snow
(4296 rep)
Oct 31, 2015, 09:21 AM
• Last activity: Jul 19, 2024, 03:04 PM
-1
votes
1
answers
309
views
Kali Linux Hostname
I have tried to get rid of this space on my host name in my Kali box: ``` ehern㉿ kali-linux ``` I have tried to modify the `/etc/hostname` and `/etc/hosts` files with Vim and still the space before the host name remains. Any way for me to get rid of it?
I have tried to get rid of this space on my host name in my Kali box:
ehern㉿ kali-linux
I have tried to modify the /etc/hostname
and /etc/hosts
files with Vim and still the space before the host name remains.
Any way for me to get rid of it?
Eduardo Hernandez
(1 rep)
Jun 30, 2024, 09:08 AM
• Last activity: Jul 3, 2024, 10:40 AM
0
votes
1
answers
347
views
$HOSTNAME mismatch
There are two different version of `hostname` on my system. This is a problem when trying to use `wget` against `$HOSTNAME`, which differs from what is expected. [user@box ~]# wget https://$HOSTNAME/login.php --2021-08-22 23:25:07-- https://superserver/login.php Resolving superserver (superserver).....
There are two different version of
hostname
on my system. This is a problem when trying to use wget
against $HOSTNAME
, which differs from what is expected.
[user@box ~]# wget https://$HOSTNAME/login.php
--2021-08-22 23:25:07-- https://superserver/login.php
Resolving superserver (superserver)... 11.22.33.44
Connecting to superserver (superserver)|11.22.33.44|:443... connected.
The certificate's owner does not match hostname ‘superserver’
[user@box ~]# echo $HOSTNAME
superserver
[user@box ~]# cat /proc/sys/kernel/hostname
superserver.some.domain.com
[user@box ~]#
[user@box ~]# hostname
superserver.some.domain.com
[user@box ~]#
How do I update my system such that $HOSTNAME
reflects what is in /proc/sys/kernel/hostname
, and what appears when I issue hostname
?
Or do I simply add a line in /etc/hosts
?
a coder
(3343 rep)
Aug 23, 2021, 03:32 AM
• Last activity: Jul 2, 2024, 07:33 AM
4
votes
1
answers
12402
views
Difference between commands >hostname and >echo $HOSTNAME and the entry hostname in /etc/rc.conf : FreeBSD
In trying to change the hostname in the bash prompt of a running system (without rebooting): 1. I tried changing the hostname of my system using the command `hostname NEW_HOST_NAME`. For good measure, I also did `/etc/rc.d/hostname restart` as suggested [in the forums][1]. Now when I issue the comma...
In trying to change the hostname in the bash prompt of a running system (without rebooting):
1. I tried changing the hostname of my system using the command
hostname NEW_HOST_NAME
. For good measure, I also did /etc/rc.d/hostname restart
as suggested in the forums .
Now when I issue the command hostname
it shows me the NEW_HOST_NAME.
But when I do echo $HOSTNAME
it still shows the old hostname.
2. So when 1 didn't work, I edited the entry against hostname in /etc/rc.conf
and ran /etc/netstart
to restart rc.conf
as suggested in mailing lists .
Changing the entry in rc.conf
does not change the output of hostname
.
And when I do echo $HOSTNAME
it still shows the old hostname. And hostname
of course shows the new name.
So I am rather lost on what is going on behind the scenes here. Any clarification/explanation would be most appreciated. And more (or maybe less) importantly how I can change the hostname of the running system so that the bash prompt gets updated (I did try source ~/.bashrc
after changing things but that obviously doesn't work since echo $HOSTNAME
still outputs the old hostname).
ahron
(434 rep)
Jan 3, 2017, 02:25 AM
• Last activity: Jun 29, 2024, 07:37 AM
Showing page 1 of 20 total questions