Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

15.3 Set up a user alias mailbox


May 24, 2021 That's what Linux should learn



User alias function is a simple and practical mail account camouflage technology, can be used to set up multiple virtual mailbox accounts to accept sent mail, so as to ensure that their e-mail address is not disclosed, but also can be used to receive their own mail in multiple mailboxes. Just now we have successfully sent an e-mail to the root account, and then send an e-mail to the bin account, as shown in Figure 15-14.

15.3 Set up a user alias mailbox

Figure 15-14 Sends mail to the bin account on the server

Sign in to the server after the message is sent, and then try to sign in as a bin account. S ince the bin account is a system account in the Linux system and the default Shell terminal is /sbin/nologin, the current account is not available when you log in with the bin account. However, after using the mail command on the email server, I saw that the message that was meant to be sent to the bin account had been stored in the letterbox of the root account.

[root@linuxprobe ~]# su - bin This account is currently not available. [ root@linuxprobe ~]# mail Heirloom Mail version 12.5 7/5/10. T ype ? f or help. " /var/mail/root": 4 messages 4 new U 1 [email protected] Fri Jul 10 09:58 1630/123103 ""abrt" full crash r" U 2 Anacron Wed Aug 19 17:47 17/619 "Anac" Ron job 'cron.dai' U 3 boss Sat Aug 15 19:02 118/3604 "Hello- U 4 boss Wed Aug 19 18:49 116/3231 "Hello, user Bin."

4 Message 4: From [email protected] Wed Aug 19 18:49:05 2017 Return-Path: [email protected] Original-To: [email protected] Delivered-To: [email protected] From: "boss" and [email protected] [email protected] D ate: Wed, 19 Aug 2017 18:49:05 +0800 Content-Type: multipart/alternative; b oundary="----=_NextPart_000_0006_01D0DAAF. B 9104E90" X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AdDabKrQzUHVBTgRQMaCtUs VtqfL1Q== Content-Language: zh-cn Status: R Content-Type: text/plain; c harset="gb2312" .................. O mit some of the output information... T his is a file sent to the user Bin. Q uit Held 4 messages in /var/mail/root is so weird! H ow did ming ming's email to the bin account get received by the root account? I n fact, this is achieved using user alias technology. A s you can see in the profile of the aliases mail alias service, there are a large number of user aliases defined, most of which are system accounts that are local to the Linux system, while root accounts after the colon (:) interval) are the people used to receive messages for those accounts. The user alias can be a local user within a Linux system or a completely fictitious user name.

The following command will show a lot of content, and given the space limitations, some cuts have been made here, and the actual output list will be more than twice that.

[root@linuxprobe ~]# cat /etc/aliases #

Aliases in this file will NOT be expanded in the header from

  1. # Mail, but WILL be visible over networks or from /bin/mail.
  2. #
  3. # >>>>>>>>>> The program "newaliases" must be run after
  4. # >> NOTE >> this file is updated for any changes to
  5. # >>>>>>>>>> show through to sendmail.
  6. #
  7. # Basic system aliases -- these MUST be present.
  8. mailer-daemon: postmaster
  9. postmaster: root
  10. # General redirections for pseudo accounts.
  11. bin: root
  12. daemon: root
  13. adm: root
  14. lp: root
  15. sync: root
  16. shutdown: root
  17. halt: root
  18. mail: root
  19. news: root
  20. uucp: root
  21. operator: root
  22. games: root
  23. gopher: root
  24. ftp: root
  25. nobody: root
  26. radiusd: root
  27. nut: root
  28. dbus: root
  29. vcsa: root
  30. canna: root
  31. wnn: root
  32. rpm: root
  33. nscd: root
  34. pcap: root
  35. apache: root
  36. webalizer: root
  37. dovecot: root
  38. fax: root
  39. quagga: root
  40. radvd: root
  41. pvm: root
  42. amandabackup: root
  43. privoxy: root
  44. ident: root
  45. named: root
  46. xfs: root
  47. gdm: root
  48. mailnull: root
  49. postgres: root
  50. sshd: root
  51. smmsp: root
  52. postfix: root
  53. netdump: root
  54. ldap: root
  55. squid: root
  56. ntp: root
  57. mysql: root
  58. desktop: root
  59. rpcuser: root
  60. rpc: root
  61. nfsnobody: root
  62. ingres: root
  63. system: root
  64. toor: root
  65. manager: root
  66. dumper: root
  67. abuse: root
  68. newsadm: news
  69. newsadmin: news
  70. usenet: news
  71. ftpadm: ftp
  72. ftpadmin: ftp
  73. ftp-adm: ftp
  74. ftp-admin: ftp
  75. www: webmaster
  76. webmaster: root
  77. noc: root
  78. security: root
  79. hostmaster: root
  80. info: postmaster
  81. marketing: postmaster
  82. sales: postmaster
  83. support: postmaster
  84. # trap decode to catch security attacks
  85. decode: root
  86. # Person who should get root's mail
  87. #root: marc

Now you can guess what's going on. T he profile of the original aliases mail alias service is specifically designed to define the mapping of user aliases to message recipients. I n addition to using the name of the system account in the local system, we can also define some alias to receive mail. For example, create an account called xxoo, and it should be the root account that actually receives the account's mail.

[root@linuxprobe ~]# cat /etc/aliases #

Aliases in this file will NOT be expanded in the header from

  1. # Mail, but WILL be visible over networks or from /bin/mail.
  2. #
  3. # >>>>>>>>>> The program "newaliases" must be run after
  4. # >> NOTE >> this file is updated for any changes to
  5. # >>>>>>>>>> show through to sendmail.
  6. #
  7. # Basic system aliases -- these MUST be present.
  8. mailer-daemon: postmaster
  9. postmaster: root
  10. # General redirections for pseudo accounts.
  11. xxoo: root
  12. bin: root
  13. daemon: root
  14. adm: root
  15. lp: root
  16. ………………省略部分输出信息………………

After you save and exit the profile of the aliases mail alias service, you need to perform the new waliases command again, which is intended to make the new user alias profile effective immediately. T hen try sending the message again, as shown in Figure 15-15:

15.3 Set up a user alias mailbox

Figure 15-15 Sends mail to the xxoo account on the server

At this point, after using the root account to execute the mail command on the server, you can see the message that was meant to be sent to the xxoo account. F inally, Mr. Liu said, user alias technology is not only widely used, but also very simple configuration. So we should remind you that in the future, do not see some websites provide a lot of customer service mailbox easily believe others, may be sent to these customer service mailbox mail will be received by the same person.

[root@linuxprobe ~]# mail Heirloom Mail version 12.5 7/5/10. T ype ? f or help. "/var/mail/root": 5 messages 1 new 4 unread U 1 [email protected] Fri Jul 10 09:58 1631/123113 ""abrt" full crash report" U 2 Anacron Wed Aug 19 17:47 18/629 "Anacron job 'cron.daily' on mail.linuxprobe.com" U 3 boss Wed Aug 19 18:44 114/2975 "hello" 4 boss Wed Aug 19 18:49 117/3242 "Hello, user Bin."

N 5 boss Wed Aug 19 19:18 115/3254 "This is a message sent to xxoo users."