0

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
  • 3,184
  • 9
  • 42
  • 63

1 Answers1

1
hostnamectl set-hostname superserver.some.domain.com
systemctl reboot now
muru
  • 69,900
  • 13
  • 192
  • 292
Grace Thompson
  • 504
  • 3
  • 7