• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Issue Change "hostname" in Plesk Obsidian does not work correctly

Kulturmensch

Regular Pleskian
(My v-serer: Plesk Obsidian 18.0.34 Update #2, Ubuntu 18.04.5 LTS)

When I change the hostname in Plesk/Tools&Settings/server settings then the files etc/hostname, etc/mailname and etc/postfix/main.cf become changed to the new hostname (as expected).

But the "helo" in E-Mails managed by postfix uses the old hostname.

Connecting to the server via ssh shows the old hostname as prompt in the bash i.e. root@{old hostname}:~# and not root@{new hostname}:~#
In addition the command root@{old hostname}:~#hostname brings up the old hostname, too.

However the command hostname -b

root@{old hostname}:~#hostname - b {new hostname} solves this problem.

After doing this the command root@{old hostname}:~#hostname now shows the new hostname, also the transmitted helo by postfix is correct and in a new ssh-session the prompt becomes: root@{new hostname}:~#, too.

However, this solution only works until a reboot of the server and I have to set hostname -b [new hostname} again. Any idea how to set a new hostname permanent?
 
Thank you for the quick reply! Plesk did not change the file etc/hosts to the new hostname so I did it manually
 
It is correct that Plesk does not change that file, because that is a basic operating system component.

Were you able to solve the issue by changing it manually? At least now after a reboot the server should know its new name.
 
Yes, currently Plesk and my server work fine. The new content of hosts is (hiding some figures with XXX):

# Auto-generated hostname. Please do not remove this comment
127.0.0.1 mail.XXX.de mail localhost.localdomain localhost
81.169.231.XXX mail.XXX.de mail

But after reboot the old content of hosts appears again. By the way are the entries ok I made in this file?
 
I have tried to investigate this issue further. After changing in Plesk <Old Hostname> to <New Hostname> and rebooting the <Old Hostname> appears again as prompt in the bash (PuTTY, ssh) and also in the header of E-Mails.

As far as Plesk is concerned everything seems to work:
etc/mailname => <New Hostname>
etc/hosts => ...<New Hostname>...
etc/hostname => <New Hostname>

But the following commands via ssh/PuTTY show:
Result of :~#hostname => <Old Hostname>
Result of :~#hostname -A => <New Hostname> <New Hostname> <Old Hostname> <Old Hostname>
Result of :~#grep -lr <Old Hostname> /etc/* => /etc/sasldb2


Now manually changing the current Hostname with :~#hostname -b <New Hostname> corrects the problem and leads to
Result of :~#hostname => <New Hostname>
Result of :~#hostname -A => <New Hostname> <New Hostname> <New Hostname> <New Hostname>

So, now everything works fine but just until the next reboot:-(

So as a quick solution to set <New Hostname> permanent I am now using a cronjob with @Reboot and the command root hostname -b <New Hostname>

This works in my case but it is not satisfying as I do not really understand where Plesk does not make the necassary additional changes.
 
Back
Top