the domain names you use when install wm/vm

When I buy a VPS from my host, I have to give it a name.
I always assumed this was just an internal name, so just called it something dumb like "bert".

Then when setting up virtualmin and webmin, at some point (sorry, I should have took notes) it asked me for a root domain or base domain or something… I just used a domain I have registered but do not currently use, call it "sparedomain.com".

Unfortunately, these two early name choices show up all over the place in my vm/wm configuration.

For instance now when I send email from vmHostedDomain1.com, full headers reveals it was "Received by sparedomain.com (Postfix, from userid 33)" which of course does not match vmHostedDomain1.com so it ends up in spam bucket.

And in "Mail Aliases" panel the "alias destinations" show up as
"myusername@bert" – other places too.

Is there a way to change these two names ("bert" and "sparedomain.com") that seem to pop up everywhere… and what is the best practice for future installs?

Thank you very much.

have been trying some experiments based on andreychek’s post below…

Changed "bert" to "ernie" in "Hostname and DNS Client"
Deleted "sparedomain.com" in "Host Addresses"
Added "myrealdomain.com" in "Host Addresses" (with IP address)
Clicked "Apply Configuration" button on Network Configuration page (several times)

In Postfix–>General Options–>"What domain to use in outbound mail":
–Checked "use domainname" AND THEN tried checking the blank field and entering "myrealdomain.com"
(restarting postfix and retesting email each time)

Despite all this:

Email coming from the domain says
"Received from ernie.localdomain" (still spam bucketed)

And

Postfix Mail Server --> Virtual domains
still say emailusername@bert
(not changed to ernie)

/etc/hosts looks like this:
127.0.0.1 localhost localhost.localdomain
127.0.0.1 ernie
x.x.x.x myrealdomain.com

(where x.x.x.x is the real ip address of course)
I tried removing the "localhost.localdomain" too but then no email went through.

So any ideas on how to set this up right would be appreciated. Thanks.

Post edited by: parsec, at: 2008/08/16 09:27<br><br>Post edited by: parsec, at: 2008/08/16 09:33

Changed "bert" to "ernie" in "Hostname and DNS Client"

Good. This is the most important place to make the change. Run the “Re-check Configuration” in Virtualmin’s Module Configuration menu so it’ll pick up the change (unless you’ve explicitly set it in the Module Configuration…which I don’t recommend, if you aren’t sure you know what you’re doing). Getting the hostname working correctly is all you should need to do on most systems.

Deleted "sparedomain.com" in "Host Addresses"

Probably not important. Having extra names in the hosts file won’t hurt anything.

Added "myrealdomain.com" in "Host Addresses" (with IP address)

Good, but only matters while you’re tinkering–you need a real DNS record for your hostname before the box can be put into service.

The host command needs to return sane answers, when you lookup your domain name, e.g.:

host virtualmin.com

In Postfix-->General Options-->"What domain to use in outbound mail":

Don’t do it! You don’t want this option set at all on a virtual hosting system. It doesn’t so what it sounds like it does…I really need to fix the help on this option to make it clear that is almost always makes things not work at all on a virtual hosting system (it probably will prevent delivery from working for any of your domains–it’s possible to set it correctly, but no one ever does).

I cannot be emphatic enough on this point. You never want to set the my_origin option on a virtual hosting Postfix system.

Postfix automatically picks up all of the stuff it needs to know, as long as your system is configured appropriately.

Email coming from the domain says

"Received from ernie.localdomain" (still spam bucketed)

Once you have appropriate DNS records for your system, you can restart Postfix (assuming you removed my_origin), and it’ll pickup the new information.

The ernie.localdomain stuff is a bit of wackiness on Ubuntu systems. I dunno why they think it’s important to have a loopback interface for the system name. It (the 127.0.0.1 ernie entry) can safely be deleted, though it’s not the source of your troubles. But you do need a localhost.localdomain entry…every system needs loopback for just about everything.

Postfix Mail Server --> Virtual domains

still say emailusername@bert

(not changed to ernie)

This is why the docs go to great lengths to recommend a proper fully qualified domain name (and why the installer won’t let you install without one). A fully qualified domain name that resolves is absolutely necessary for a working virtual hosting system…it simply cannot work without one. And getting it right from the get-go is easier than fixing it later. :wink:

You may need to re-create those accounts once things are looking more normal, but there might be a way to automate the update. I’ll look into it, and get back to you.

Thanks so much for all the advice… I’m still confused but making some headway.

I finally got "received by myrealdomain.com" in full headers
by putting "myrealdomain.com" in both
/etc/hostname
/etc/mailname

BTW, tt looks like postfix uses /etc/mailname as default origin. (This is Ubuntu Hardy.) When I first looked in there it just said "hardy2" (strange).

Thank you again!