Solved

List all email accounts on Linux  server

Posted on 2013-11-26
12
789 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
  • 6
  • 5
12 Comments
 
LVL 19

Accepted Solution

by:
xterm earned 375 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 19

Expert Comment

by:xterm
Comment Utility
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
Comment Utility
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
Comment Utility
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
Too many email signature changes to deal with?

Are you constantly being asked to update your organization's email signatures? Do they take up too much of your time? Wouldn't you love to be able to manage all signatures from one central location, easily design them and deploy them quickly to users. Well, you can!

 
LVL 19

Assisted Solution

by:xterm
xterm earned 375 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
xterm, last question

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

Assisted Solution

by:xterm
xterm earned 375 total points
Comment Utility
/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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Explore the encryption capabilities built into Google Apps and how these features can help you meet privacy policy and regulatory compliance, but are not a full solution. Understand and compare the most popular email encryption services for Google A…
In this video we show how to create a mailbox database in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Servers >> Data…
This Micro Tutorial will demonstrate the easy use of Gmail embedding images in your email so the recipient of your email can view them in context.

763 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now