Solved

List all email accounts on Linux  server

Posted on 2013-11-26
12
1,079 Views
Last Modified: 2013-11-26
Dear Experts,

How I can list out all email account that had been set on my Linux server ?
all  email account address are saved in one file, where ?
(Note: I had used Cpanel before , now I created email account  with root access
in this year)

I check at /etc/aliases that I could not understand which one is email account or
not. Please help to explain the file in detail ?

Please help and advise that I 'm appreciated

Duncan

aliases file at /etc
=================
#
#  Aliases in this file will NOT be expanded in the header from
#  Mail, but WILL be visible over networks or from /bin/mail.
#
#       >>>>>>>>>>      The program "newaliases" must be run after
#       >> NOTE >>      this file is updated for any changes to
#       >>>>>>>>>>      show through to sendmail.
#

# Basic system aliases -- these MUST be present.
mailer-daemon:  postmaster
postmaster:     root

# General redirections for pseudo accounts.
bin:            root
daemon:         root
adm:            root
lp:             root
sync:           root
shutdown:       root
halt:           root
mail:           root
news:           root
uucp:           root
operator:       root
games:          root
gopher:         root
ftp:            root
nobody:         root
radiusd:        root
nut:            root
dbus:           root
vcsa:           root
canna:          root
wnn:            root
rpm:            root
nscd:           root
pcap:           root
apache:         root
webalizer:      root
dovecot:        root
fax:            root
quagga:         root
radvd:          root
pvm:            root
amanda:         root
privoxy:        root
ident:          root
named:          root
xfs:            root
gdm:            root
mailnull:       root
postgres:       root
sshd:           root
smmsp:          root
postfix:        root
netdump:        root
ldap:           root
squid:          root
ntp:            root
mysql:          root
desktop:        root
rpcuser:        root
rpc:            root
nfsnobody:      root

ingres:         root
system:         root
toor:           root
manager:        root
dumper:         root


newsadm:        news
newsadmin:      news
usenet:         news
ftpadm:         ftp
ftpadmin:       ftp
ftp-adm:        ftp
ftp-admin:      ftp
www:            webmaster
webmaster:      root
noc:            root
security:       root
hostmaster:     root
info:           postmaster
marketing:      postmaster
sales:          postmaster
support:        postmaster


# trap decode to catch security attacks
decode:         root

# Person who should get root's mail
#root:          marc

Open in new window

0
Comment
Question by:duncanb7
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
12 Comments
 
LVL 19

Accepted Solution

by:
xterm earned 375 total points
ID: 39679002
If you are using standard Unix accounts which you are adding with the useradd (or adduser) command, then all of them will be in /etc/passwd.

If you are using something different, then let me know how you add users and what mail server software you have, and I'll tell you where to look.
0
 
LVL 10

Assisted Solution

by:Luxana
Luxana earned 125 total points
ID: 39679013
Have you tried to look into spool directory. That should give you a hint on how many email accounts you might have on your system. Usually the spool directory is located under:

/var/spool/mail/

so simply do :

# ls /var/spool/mail/
0
 
LVL 13

Author Comment

by:duncanb7
ID: 39679036
yes I can less /etc/passwd to see all of my account but it doesn't
show some hidden email account that is why I am asking this thread
and use sendmail -bv mylogin@mysite.com is showing "fail to verify:
no such user) but the mylogin is shown by "less /etc/passwd"

(Suppose email address before @sign is exactly same as user account
by adduser, Right ?)

I am using SquirrelMail now and I see there is mailman stuff in my cpanel
3rdpatry directory that I had no longer to use it in cpanel since it's expired

Duncan
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 19

Expert Comment

by:xterm
ID: 39679076
SquirrelMail is just the web-based interface to view mails that have already come in - it's not your MTA (message transfer agent, AKA actual mail server software)

You are probably using Exim by default with cPanel.

Please run these 3 commands and let me know what they return:

ps ax | grep exim
ps ax | grep postfix
ps ax | grep sendmail
0
 
LVL 13

Author Comment

by:duncanb7
ID: 39679078
I also try /var/spool/mail/, it just show account created by  adduser
and some is not shown that might be caused it was created by cpanel before
DO you think so ?

What is aliases file for ?

Why those account shown /var/spool/mail can NOT be verified
by sendmail -bv mylogin@mysite.com ? it always reports
"fail to verify : no such users"
0
 
LVL 13

Author Comment

by:duncanb7
ID: 39679094
ps ax |grep exim
  684 ?        Ss     0:00 /usr/sbin/exim -bd -q1h
12343 pts/3    D+     0:00 grep exim

 ps ax |grep postfix
12347 pts/3    S+     0:00 grep postfix

 ps -aux |grep sendmail
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ
mylogin 12349  0.0  0.0   6300   192 pts/3    R+   05:18   0:00 grep sendmail


there is NO postfix, and i can run sendmail.  Could you brief the different between them ?

Be reminded : I had no longer to use Cpanel more than 2 years
0
 
LVL 19

Assisted Solution

by:xterm
xterm earned 375 total points
ID: 39679139
Exim is your mail server.  Postfix and sendmail are just two other different types of mail servers - they're all fine, but cPanel usually sets up Exim by default, and did in this case.

Your email accounts can be found here:

/home/<username that you set up for your domain>/mail/<your domain name>
0
 
LVL 13

Author Comment

by:duncanb7
ID: 39679159
yes, it is email account I created in Cpanel

Now

1-Some is at /home/mycpanel-email-account/mail/

2-Some is at /var/spool/main (this is unix adduser account)

 Item 1 can be verified by sendmail but item-2 can not be verified

How Exim can use for normal unix adduser account not just by Cpanel ?
0
 
LVL 19

Expert Comment

by:xterm
ID: 39679168
See my reply in your other thread.  cPanel will probably have to be uninstalled completely and the system reverted back to how it was.  You might have to Google that one and see how other people got rid of theirs.

Personally, I would do a fresh installation of CentOS and start over.
0
 
LVL 13

Author Comment

by:duncanb7
ID: 39679223
xterm, last question

what is /etc/aliases for or  related to Mail  ?
0
 
LVL 19

Assisted Solution

by:xterm
xterm earned 375 total points
ID: 39679380
/etc/aliases is part of sendmail - Exim doesn't use it.

It allows you to direct mail for certain names that don't actually have accounts on the system to different places.

So if your name was John Doe, you could create your account jdoe in Unix, and then put the following in /etc/aliases:

johndoe:  jdoe
johnd:      jdoe
doe:         jdoe

Then all the mail that gets sent to those incorrect addresses will still get delivered to the main jdoe account.
0
 
LVL 13

Author Closing Comment

by:duncanb7
ID: 39679396
I will continue this with new thread and new question

Thanks for all of your reply

have a nice working day

Duncan
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Marketers need statistics and metrics like everybody else needs oxygen. In this article we explain how to enable marketing campaign statistics for Microsoft Exchange mail.
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
In this Experts Exchange video Micro Tutorial, I'm going to show how small business owners who use Google Apps can save money by setting up what is called a catch-all email address in their Gmail accounts. By using the catch-all feature, small busin…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question