LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-27-2012, 04:51 AM   #1
Pratique
LQ Newbie
 
Registered: Jun 2012
Location: Noida
Posts: 5

Rep: Reputation: Disabled
Post Unable to change the sender from root to user in postfix


Hi All,

I have a Linux 2.6 x86 machine and currently I am battling with email deployment on it. The problem is by default the server sends emails through the address root@localdomain.com which is not valid.
I want the sender to be changed to username@newdomain.com.

So far, after days of googling, I have been able to change only the domain part and now the server sends mail through root@newdomain.com which is again invalid.

I have updated the following entries:
/etc/postfix/generic
/etc/postfix/main.cf
/etc/postfix/alias

But still the mail appears to use the root username for sending which does not get delivers, here are the logs :

[root@myserver]# tail -f /var/log/maillog
Jun 27 05:11:54 myserver postfix/pickup[12653]: C86C9115027: uid=0 from=<root>
Jun 27 05:11:54 myserver postfix/cleanup[16739]: C86C9115027: message-id=<20120627091154.C86C9115027@myserver.localdomain>
Jun 27 05:11:54 myserver postfix/qmgr[12654]: C86C9115027: from=<root@newdomain.com>, size=301, nrcpt=1 (queue active)
Jun 27 05:11:56 myserver postfix/smtp[16741]: C86C9115027: to=<abc@xyz.com>, relay=smpt.relay.server[10.135.40.20]:25, delay=1.6, delays=0/0/1.2/0.42, dsn=5.1.7, status=bounced (host smpt.relay.server[10.135.40.20] said: 550 5.1.7 <root@newdomain.com>... Unknown sender (in reply to MAIL FROM command))
Jun 27 05:11:56 myserver postfix/cleanup[16739]: BB551115028: message-id=<20120627091156.BB551115028@myserver.localdomain>
Jun 27 05:11:56 myserver postfix/qmgr[12654]: BB551115028: from=<>, size=2215, nrcpt=1 (queue active)
Jun 27 05:11:56 myserver postfix/bounce[16742]: C86C9115027: sender non-delivery notification: BB551115028
Jun 27 05:11:56 myserver postfix/qmgr[12654]: C86C9115027: removed
Jun 27 05:11:58 myserver postfix/smtp[16741]: BB551115028: to=<root@newdomain.com>, relay=smpt.relay.server[10.135.40.20]:25, delay=1.6, delays=0/0/1.2/0.43, dsn=5.1.1, status=bounced (host smpt.relay.server[10.135.40.20] said: 550 5.1.1 <root@newdomain.com>... Unknown user (in reply to RCPT TO command))
Jun 27 05:11:58 myserver postfix/qmgr[12654]: BB551115028: removed

[root@myserver]#


Can anyone please help me?
 
Old 06-27-2012, 07:03 AM   #2
descendant_command
Senior Member
 
Registered: Mar 2012
Posts: 1,876

Rep: Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643
So what is creating the mail?
You need to configure that.

Also what rules does your relay server enforce?
 
Old 06-27-2012, 08:58 AM   #3
Pratique
LQ Newbie
 
Registered: Jun 2012
Location: Noida
Posts: 5

Original Poster
Rep: Reputation: Disabled
Where should I configure ?

I used the following command to send the mail:

Echo "Hello World" | mail -s "GM" abc@xyz.com

and received the log which I pasted above. As far as SMTP Relay setting are concerned, the entries are updated properly. Issue is to change the sender from root@newdomain.com to user@newdomain.com.
 
Old 06-27-2012, 03:36 PM   #4
descendant_command
Senior Member
 
Registered: Mar 2012
Posts: 1,876

Rep: Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643
So log in as 'user' not 'root', and then send the mail...
 
Old 06-28-2012, 04:17 AM   #5
Pratique
LQ Newbie
 
Registered: Jun 2012
Location: Noida
Posts: 5

Original Poster
Rep: Reputation: Disabled
Netbackup Application

My need is to make netbackup deliver emails. Netbackup uses the mailx utility on the server to send mails (which is root by default).
But here root's address is invalid and it does not sends mail.

That's why I am looking for an alternative to send emails.
 
Old 06-28-2012, 04:32 AM   #6
descendant_command
Senior Member
 
Registered: Mar 2012
Posts: 1,876

Rep: Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643
From 'man mailx'

Quote:
-r address
Sets the From address. Overrides any from variable speci‐
fied in environment or startup files. Tilde escapes are
disabled. The -r address options are passed to the mail
transfer agent unless SMTP is used. This option exists
for compatibility only; it is recommended to set the from
variable directly instead.
 
Old 06-28-2012, 05:39 AM   #7
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.2
Posts: 1,339

Rep: Reputation: 260Reputation: 260Reputation: 260
I suggest lines in sender_canonical like:
Code:
/root@localdomain.com/ user@newdomain.com
/^(.*@)(.*)$/     ${1}newdomain.com
and access it in main.cf:
Code:
sender_canonical_maps = regexp:/etc/postfix/sender_canonical
As it’s a regexp, there is no postmap necessary. But you can also use a hash, if it suits your needs better

Documentation
 
Old 06-28-2012, 08:47 AM   #8
Pratique
LQ Newbie
 
Registered: Jun 2012
Location: Noida
Posts: 5

Original Poster
Rep: Reputation: Disabled
Still not working

Is there anything I need to change in main.cf file ?
The system continues to send mails through root.

@descendant_command The "-r" switch cannot be specified. Netbackup communicates with the server in the background and calls mailx. There is no way I can put a switch to the emails sent.
 
Old 06-28-2012, 08:49 AM   #9
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.2
Posts: 1,339

Rep: Reputation: 260Reputation: 260Reputation: 260
The sender_canonical_maps line is in main.cf and you restarted postfix?
 
Old 06-28-2012, 11:54 AM   #10
Pratique
LQ Newbie
 
Registered: Jun 2012
Location: Noida
Posts: 5

Original Poster
Rep: Reputation: Disabled
Yes I did restart.

The postfix was reloaded after making changes.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Unable to change system time as a non-root user cruiser Linux - Newbie 3 08-08-2011 11:47 PM
How to change a process running in root-user to non-root user ???????????????????? narendra1310 Linux - Software 4 10-29-2009 02:11 AM
Unable to change user: *su root* nedimyra Linux - Software 11 09-10-2006 11:14 AM
Postfix unable to deliver mail because user@virtualdomain becomes user@hostname azrael808 Linux - Networking 0 04-29-2006 12:35 PM
Unable to logon on as non-root user after update as unable to set executable context pls198 Fedora 2 04-09-2004 11:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 05:18 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration