How to set the name of a computer for postfix / mail?
The smartmontools daemon (smartd) can send mails to e.g. root, if and when a warning or error for a hard disk occurred. One sets the mail address like "root@linux" in /etc/smartd.conf. When a real mail is sent, the mail agent appends "site" to the above denominator like so root@linux.site and the mail is duly sent and received.
How can I change "linux" to something more meaningful? I know that I set this up (possibly during installation), but I want to change it now. <edit> It is not set from "/etc/HOSTNAME", remarcably... </edit> And while we are at it: can I change "site" too? |
Take a look at man smartd.conf, particularly the -m and -M options for background and detailed information; I suspect, though, that you can simply edit the e-mail address(es) in /etc/smartd.conf then stop and restart the daemon:
Code:
su - Hope this helps some. |
Quote:
Quote:
I suspect that this is hidden in some .conf file, like HOSTNAME is. That's what I am looking for, to rename my machine in the eyes of postfix. <edit> In /etc/postfix/main.cf is a line like this: "myhostname = linux.site". Put there probably by the "SuSEconfig.postfix" program. Which is parameterized how? :rolleyes: </edit> |
Oh. Well, OK...
Just for grins, what does Code:
uname -n This might seem like overkill but you more or less know that linux.site has got to be buried somewhere in some blasted file, so why not Code:
su - |
Code:
uname -n Code:
netbook I am not running fixed IP. In /etc/hosts is Code:
127.0.0.1. localhost DHCP_HOSTNAME is not defined as far as I can see. How to check it outside of YAST? Code:
su - |
Code:
uname -n Code:
netbook I am not running fixed IP. In /etc/hosts is Code:
127.0.0.1. localhost DHCP_HOSTNAME is not defined as far as I can see. How to check it outside of YAST? Code:
su - <edit> In /var/log/mail I found Code:
Networkmanager: <info> Setting system hostname to 'linux.site' (from system configuration) |
Are you running KDE? Maybe take a look at the system configuration options? Probably need to be root when you do anything with it (I'm running Xfce but I can look at the KDE System Settings from it).
Other place to look is /etc/mail, maybe in local-host-names and helpfile. Gotta be there someplace |
One solution which I have used with both postfix and sendmail (but I think it is picked up by the mail-generating program, not the MTA) is to change root's line in /etc/paswd, setting the 5th field to root@<hostname> (where <hostname> is the hostname you want).
|
Quote:
Quote:
Quote:
P.S.: I had to break off the systemwide search yesterday. It's just restarted (after I umounted all unnecessary partitions ;)). But Code:
ps ax | grep find Code:
2361 pts/0 S+ 0:00 find / -type f |
Quote:
Code:
root:x:0:0:root:/root:/bin/bash Code:
root:x:0:0:root@netbook:/root:/bin/bash |
You should probably try to kill that find (if it's still running)
Code:
su - Trying to remember where the mail files used to be, I think in /var somewhere, maybe in /var/spool; if you've got sendmail those configuration files are someplace. Look for aliases, aliases.db, sendmail.cf; e.g., Code:
find /var -type f -name 'aliases*' |
Been away for a week, back to work now ;).
I already killed the "find", no problem there. "/etc/aliases" in SuSE systems holds mappings for users like lp: root or postgres: root. There are no machine names in there, I checked. There is also an aliases.db, with what would I open that? "sendmail*" does not exist, though. Any more ideas? |
No sendmail, huh? Well, who knew.
Anyway, have you tried simply setting the system name and domain in /etc/HOSTNAME and reboot the thing? Take a look at the manual page for hostname; simply typing Code:
hostname Code:
hostname sysname It's usual that you can set the host and domain in /etc/rc.d/rc.inet1 or /etc/init.d/boot and look at /etc/host.conf (if you don't have one or more of those files; e.g., in /etc/rc.d, look for a file of that name somewhere in the /etc directory). Note that, if the system name is not set in one of those you probably don't want to mess with it; if the system name is set in one of those files and it's the wrong one, change it and reboot. Most every system I've ever worked with, both Unix and Linux, takes the system name setting from /etc/HOSTNAME (or some variant of that). Whatever is overriding your system name is going to be found in some configuration file somewhere and you should find that and either comment out the "wrong" name or simply change it with an editor. Whatever file that network manager uses for configuration (and I have no idea what that might be) is probably where you'll find the problem; might be worth a look-see at the manual page for the network manager? I dunno. Hope this helps some. |
Quote:
I tried Code:
hostname test There is no /etc/rc.d/rc.inet1. There is an /etc/init.d/boot.localnet which loads the system variable $HOSTNAME with the content of /etc/HOSTNAME (i.e. "netbook"). /etc/host.conf is the "resolver conofiguration file" with two lines Code:
order hosts, bind Quote:
I used Code:
find / -type f -newer /root/timestamp > op |
I don't know if this will help but here's an example program that will print your host and domain name using the gethostname() and getdomainname() functions.
Code:
/*********************************************************************** Code:
make gethostname The above example comes from http://www.ccplusplus.com/2011/11/ge...example-c.html. Note that (from the getdomainname manual page): Quote:
|
All times are GMT -5. The time now is 07:19 AM. |