• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

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