LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Adding new user and getting sendmail to work (https://www.linuxquestions.org/questions/linux-newbie-8/adding-new-user-and-getting-sendmail-to-work-944425/)

now4mike 05-11-2012 10:18 AM

Adding new user and getting sendmail to work
 
I am new to using Linux, but have been put in a possition to manage a system using it, with Slackware, to run the email accounts.
I attempted to add myself as a new user, and I show-up in the /home directory.
My problem is that I don't feel that I did everything correct because using outlook (POP3), I am able to send mail to everyone, but I can only receive mail back from persons in the same domain as me. All other mail is rejected because "name not recognized".

Again, I am very new to the Linux world, although I am getting a crash course (not literally, yet) in it's use.

Ser Olmy 05-11-2012 10:32 AM

Assuming the rejecting mail server is your sendmail server and not some other filtering server in front of it, it would seem that sendmail doesn't associate your (external) mail address with your local account on the server.

You may have to add your address to /etc/mail/virtusertable.

now4mike 05-11-2012 10:34 AM

Ser Olmy,

I know that this will prove that I am really a rookie at this, but I have tried to do that but don't know the code for doing such.

Ser Olmy 05-11-2012 10:47 AM

/etc/mail/virtusertable is a text file, and can be edited with any text editor. A Slackware distribution contains a number of these, some more newbie-hostile than others (I'm looking at you, vi). pico should do nicely, it even shows the keybord shortcuts to the most common operations at the bottom of the screen.

pico /etc/mail/virtusertable should get you started. You have to add a line containing your external mail address and your local account name, as explained here.

Exit and save with Ctrl-X (press Y and then enter to save the changes), then rebuild the virtusertable.db file with the following commands:
Code:

cd /etc/mail
make


now4mike 05-11-2012 11:04 AM

I am familure with the text editing. I have been using jed for that. I have been in this file in the past, and am currently in the file, but there is nothing in it that shows me the format for what the actual entry should be.
When I just put in my username, the system saves it, but doesn't "make" any changes to the db and nothing changes.
Once in the file, what is it that I need to place in the file?

Like in "aliases" I put:
username: <tab> username.domain.com
and then saved, exited and typed "make" and it updated the aliases db.

---------- Post added 05-11-12 at 11:05 AM ----------

that one line should have been:
username: <tab> username@domain.com

Ser Olmy 05-11-2012 11:09 AM

The format of virtualusertable is explained in the wiki article I linked to. The article also says "If there is no match in the virtusertable file, sendmail checks for the full email address in the /etc/aliases file". In other words, a proper entry in /etc/mail/aliases should do the trick.

Are you sure the mails are being rejected by your server? What is the exact error message being returned?

now4mike 05-11-2012 11:18 AM

I am sure they aren't getting through. I sent a test from my gmail and it didn't go through, and I even sent my gmail a test and it received it and when I tried to reply, it didn't work.
Here is the error message:

Delivery to the following recipient failed permanently:

michaelc@domain.com

Technical details of permanent failure:
Google tried to deliver your message, but it was rejected by the recipient domain. We recommend contacting the other email provider for further information about the cause of this error. The error that the other server returned was: 550 550 No such user - psmtp (state 13).

----- Original message -----

DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20120113;
h=mime-version:date:message-id:subject:from:to:content-type;
bh=xVJQEBX7wkg6sHwyIIzVUE3vyHM7kPITlRoPXGVBHjY=;
b=Gn0hLL/R0a1A5TQhfhRgnspPnZP9c9S7ZD7PXsJpLZqcgDp++gigCgdSM5+uvzlayv
N8/MNNxMOz6SfSWk5YgMj2LbJT76lI+7+gaSmanQ1bMZ9lfVP6po5qESDg4cbluRjvgQ
2PByjz7+5U2cXihZ/E1dbFuAS6iFfQXe2hVYKgzWlA7rDeX/7TXldPWHn7PLEh9ML9eu
MRq+FKlZ6WuSlzWXuKIh4i6Jr9FScgt9yZyW89XctMhbbPahfmDzzQ606ZgrclNOAhPS
dBFyTl7zCePgp/F8xCOP7H2bDZYoGcWtg5+T0MXLZouxVlnKX7YpjL9ql8n5vRBHvKzF
PPtQ==
MIME-Version: 1.0
Received: by 10.216.27.200 with SMTP id e50mr1690068wea.23.1336747085392; Fri,
11 May 2012 07:38:05 -0700 (PDT)
Received: by 10.180.105.66 with HTTP; Fri, 11 May 2012 07:38:05 -0700 (PDT)
Date: Fri, 11 May 2012 08:38:05 -0600
Message-ID: <CAJKotTHc5qLrEJ2t5EQyOgHUoaPpp_=Hsf29RUHHf1i64dyvyg@mail.gmail.com>
Subject: Test
From: Name <username@gmail.com>
To: michaelc@domain.com
Content-Type: multipart/alternative; boundary=00504502c6572ded9304bfc3af28

Ser Olmy 05-11-2012 11:42 AM

It's not immediately clear from the error message above which server is producing the 550 error. If host -vt mx domain.com return the DNS name and IP address of your server, you can be reasonably certain that no other servers are involved.

Also, there's the telnet test. Telnet to your server on port 25 (telnet IP address 25), and pretend to be an SMTP-speaking mail server. Type the text in bold (and replace the values in bold and italics with something sensible):

Code:

220 servername.domain.com ESMTP Sendmail (version); Fri, 11 May 2012 (time of day)
HELO anything
250 servername.domain.com Hello (name) [(IP address)], pleased to meet you
MAIL FROM: <an external mail address>
250 2.1.0 <an external mail address>... Sender ok
RCPT TO: <michaelc@domain.com>

If the server responds with "550 5.1.1 <michaelc@domain.com>... User unknown", then you know that something is amiss in /etc/mail/aliases. (Type QUIT to end the SMTP session.)

Does /etc/mail/aliases contain the e-mail addresses of the other users of this system? Have you tried restarting sendmail (/etc/rc.d/rc.sendmail restart on Slackware)? It shouldn't be necessary, but ...

now4mike 05-11-2012 12:24 PM

Ser Olmy,

I apologize, but I am not having any luck. Here is what I got trying to follow what you wrote:

root@server:/etc/mail# HELO anything
bash: HELO: command not fount
root@server:/etc/mail# MAIL FROM <1sgmike@gmail.com>
bash: syntax error near unexpected token 'newline'
root@server:/etc/mail# MAIL FROM 1sgmike@gmail.com
bash: MAIL: command not found
root@server:/etc/mail#RCPT TO: michaelc@domain.com
bash: RCPT: command not found
root@server:/etc/mail# HELO
bash: HELO: command not found
root@server:/etc/mail# cd //
root@server://# HELO anything
bash: HELO: command not found
root@server://# cd etc
root@server://etc# cd rc.d
root@server://etc/rc.d# rc.sendmail restart
bash: rc.sendmail: command not found
root@server://etc/rc.d# sendmail restart

and now it is just hung up sitting there with apparently nothing happening.

OF NOTE: One thing that is very confussing, is that everyone else seems to get email from outside the domain. It's just me...thankfully.

Additionally, I can't seem to see inside the aliases db file.

Ser Olmy 05-11-2012 12:34 PM

You didn't actually follow what I wrote. :)

To connect to the mail server with telnet, you must use telnet to connect. If you're logged in to the server, you can connect directly to localhost with telnet localhost 25.

The .db files in /etc/mail are not human-readable. They are database files created by sendmail, and contain data from the corresponding text files: aliases.db is the database version of aliases, virtusertable.db is the database version of virtusertable and so on.

The idea is that sendmail takes the contents of the (potentially very large) text files and turns them into some sort of database to reduce the time it takes to search through the data. That's why you have to run "make" from /etc/mail whenever you make changes to any of those files. From what I can tell, the "make" bit seems to be Slackware-specific. Other distributions have a script called "newaliases" that does the same.

So, did you run make after adding your mail address and account name to /etc/mail/aliases?

Also, the command to restart sendmail is /etc/rc.d/rc.sendmail restart. You have to type the entire path.

now4mike 05-11-2012 12:59 PM

OK, I did it correctly this time. It said, "Sender OK" and "Recipient OK".
Then I did the restart and it said:
Starting sendmail MTA daemon: user/sbin.....
Starting sendmail MSP queue runner: user/sbin.....

But I tried sending an email from gmail again and it still didn't work.

Oh, yes I did run "make" and it said "nothing to be done for 'all'.

Ser Olmy 05-11-2012 01:04 PM

"Recipient OK" is not what I would have expected, as it means that sendmail is happy to receive mail to your address. Though it could be that sendmail interprets your address as non-local, and permits relaying from localhost. Can you run the test from another system?

When you tried to send from GMail, does an error message appear in /var/log/maillog? Try running tail -f /var/log/maillog, then send a new message from Gmail. You should see the error message appear in the log in real time (Ctrl-C aborts).

now4mike 05-11-2012 01:16 PM

I did as you stated, correctly this time, and at MAIL FROM: my.gmail it said "sender ok" and at RCPT TO: michaelc@domain.com it said "recipient ok".
Then I did the full restart you stated and it said:
Starting sendmail MTA daemon: user/sbin....
Starting sendmail MSP queue runner: user/sbin....

Then I went to etc/mail/# make

and it said "make: nothing to be done for 'all'

but when I tried to send another email from gmail, it didn't work...again.

now4mike 05-11-2012 01:31 PM

I did it twice and got:

May 11 12:19:34 romulus popper [27039]: (v4.0.5) POP login by user "michaelc" at (192.168.**.**) 192.168.**.***

Same thing both times.

now4mike 05-11-2012 01:36 PM

I have another one for you...
While in the maillog, I noticed a lot of errors occuring because the calendar has a typo in the domain name. How would I go about correcting that?


All times are GMT -5. The time now is 07:30 PM.