Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Users 1

Status
Not open for further replies.
Once sendmail is setup and running you should be able to receive mail for any user on your system. Befor that user can get their mail from your server, you will need to have a POP3 and/or IMAP server running. Most linux distros already provide these. In the case of imap, you should have the executable /usr/sbin/imapd which is a daemon that runs under xinetd. To tell xinetd that you want to enable the imap service, you need to edit /etc/xinetd.d/imap. Look for the line that says "disable = yes" and change it to "no". The procedure is the same to enable the POP3 service. You can run both and let xinetd choose which one based on the preference of the client making the request. Only users that have an account on your linux system can have e-mail accounts. If you will have users that have e-mail only and not login access, you can create a "Group" for these users. When you create new user accounts, you can add them to that group. Since they won't have login access, they will not need to have a /home/ directory created which is the usual default when adding a new user. The login shell should be set to "/sbin/nologin". Other than that, there is no configuring of the pop3 or imap servers.


 
Cool, thanks linux is awesome,

So, I need to have user accounts on my system. Like if my domain is and mu mailserver is mail.linux.com

I need users on my linux box like: Jim Andrew Jarod Will

their addreses will be jim@linux.com and so forth?
 
You will also have to set them up in the aliases file which is located in either /etc or /etc/mail.
Once you have added them to the aliases file you will need to run the newaliases command or the sendmail -bi command.
If you don't want to users grant shell access but need the /home/dir$ for something like procmail recipes you can edit the /etc/passwd and change the default shell (probably bash) to false.

Cogito Ergo Sum - Non Compos Mentis
 
What is the command to add users to sendmail?? Is root already added?
 
useradd -g <put group name here> username
passwd username
The root account was created when the operating system was installed.

Cogito Ergo Sum - Non Compos Mentis
 
Yes pop3 and imap use the system user/password combo. You don't have to us aliases. However, it wouldn't be a bad idea to alias root to your regular (non-root) user name. You do NOT need to create accounts for non-real users such as webmaster. For this type of user, you would use the virtusertable. This file looks very much like /etc/mail/aliases but lets you do a lot more. Here is an example of what it would look like:

webmaster@mydomain.com joe #this will go to user joe
info@mydomain.com ed@isp.net #gets relayed to specified address
joe@domain2.com joedoakes
joe@mydomain.com joe
@mydomain.com error:nouser No such user here

Generally joe@mydomain would not be needed because joe is a real user but it is there because of the last line. The last line is basically a catchall. Anybody not accounted for in the list, will return an error message. In this case, the message will be &quot;No such user here&quot;. This is needed especially if you host more than one domain. It allows for the same user name by more than one domain. Keep in mind that your system will not allow two users with the same name. This is the whole reason for virtual users.

 
Id don't know what distro you're using but in Red Hat, root is aliased to marc. This needs to be changed to whatever your regular user name is unless you want to login as root to check root's mail.
 
how do I set up the alias file. could someone post an example?? Also an example for the virtusertable.

I am getting mail to the server, it just won't get the the actual users inboxes.

Thanks
 
If your system is receiving mail it will be stored in /var/spool/mail/username as long as that user has a valid system account (or exists in the /etc/passwd file ...etc. etc.)
Aliases file example:
#Test User
username
or
#Test User
firstname.lastname: user
There is an example of a virtuser file above posted by RhythmAce.

Cogito Ergo Sum - Non Compos Mentis
 
If mail is getting to your server, then sendmail has done it's job. If you have a user named joe, then his mail gets stored on the server as /var/spool/mail/joe. All of joes e-mail is in that one file. You can look at it with a text editor but it won't make much sense to you because everything is all jumbled together. For Joe to get his mail, he would use his trusty ol' mail client, Outlook Express. It is the client that creates the Inbox, Outbox and whateverbox. The mail client uses the following information: user name, password, name of mail servers and whether you want to get your mail via POP3 or IMAP. With POP3, the file is emptied after pop server sends the mail to the client and with imap, the user can leave the mail on the server. Now when joe@yourdomain.com requests his mail, DNS looks up the MX record for yourdomain.com and sees who handles the mail for that domain. The request is then sent to that ip address. If the request comes in on port 110, then the pop3 server handles it. The pop server assumes everything before the &quot;@&quot; is the username. If that user exists on the system, the password is checked. If everything is cool, the pop server sends /var/spool/mail/joe to the requesting client. The client then works its magic and breaks the file down into individual e-mails and stores them in Joe's Inbox. Since the job of the pop3 or imap servers are so simple, they usually never need configuration. All the configuring was done when the server was compiled. Sendmail on the other hand uses many files. Because you asked, I'll give you a brief rundown on the ones you'll most likely use.

1) /etc/mail/sendmail.mc - This file is a list of macros. It isn't used by sendmail. Sendmail uses sendmail.cf which is compiled from sendmail.mc using the macro compiler, m4.

Example: m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

2) /etc/mail/aliases - This file is just a list of fake names paired with real names with at least one tab in between them:

webmaster joe
sales fred

then names on the left MUST resolve to a real user on your system. When you are done editing this file, issue the following command: newaliases

3) /etc/mail/virtusertable - This file looks exactly like aliases but is more powerful. The entries can be an e-mail address, ip address, virtual user such as webmaster or an entire domain. Just as in the aliases file, the entries on the right MUST be valid destinations. When you are done, issue the following command:

makemap hash /etc/mail/virtusertable.db < /etc/mail/virtusertable

4) /etc/mail/access - This one is very inportant. It tells sendmail who can pass mail through your server. When you open it, you will see a few entries already there such as localhost and 127.0.0.1. Be sure to add your domain and public ip to the list:

yourdomain.com RELAY
xxx.xx.x.xx RELAY

If you have a user or domain that you no longer want to use you server you would add their name but use the word REJECT. When done issue the following comand:

makemap hash /etc/mail/access.db < /etc/mail/access

5) /etc/mail/local-host-names - Add your host name and any of its aliasses here

Don't forget to restart sendmail after editing most of theses.


 
Thanks, got it working. It was the local-host-names i think.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top