1. Trang chủ
  2. » Công Nghệ Thông Tin

debian gnu linux bible phần 9 pot

68 282 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 68
Dung lượng 592,19 KB

Nội dung

530 Part V ✦ Linux Server The results of the test should appear as follows: jo Connecting to local jo Sent The -v tells sendmail that you want to use it in verbose mode, which means it prints everything it does. The account the mail was sent to is jo, and the letter is what you created. Now jo should have some mail if everything worked. Log in as jo to get the mail. You can also include all the To:, From:, and Subject: information usually found in messages. Normally, sendmail is used through some type of client. Some situations may call for sending mail through the command line, in which case the previous command will work. Some examples of situations in which you might want to use sendmail from the command line include during, after, or as a result of an automated task. In this way, sendmail can notify administrators of problems or the completion of tasks, or it can broadcast an e-mail message. General Mail Considerations Now that you have a mail server installed on your system, you need to understand a few topics. that tend to affect more than one specific mail system. As such, they are covered in the following sections under different categories. E-mail aliases Most e-mail servers make use of an alias file. Because it is not recommended that certain accounts log in to a console such as root, daemon, and several others, mail sent to these accounts can be rerouted to another account that does log in on a reg- ular basis. Mail sent to these system accounts, usually error messages, typically get aliased to the root account. Then the root account can be aliased to the administra- tor of the system. This just means that when the server goes to send mail to one of these accounts, it will be redirected to whomever needs to see the mail. The alias information is kept in /etc/aliases (or alternately /etc/mail/aliases, depend- ing on your choice of mail server), which can be edited so that the correct people receive the mail notices. You can also add virtual accounts in this file. A virtual account is not a real account, but a name by which users can receive e-mail. For instance, “webmaster” may not be an account set up for log in, but the person who manages the Web pages may want to use that ID for e-mail. In cases where several people may rotate through a position, it’s easier to change a name in a file to redirect mail, than to change an e-mail address on hundreds of Web pages. 4710-0 ch25.F 4/10/01 11:28 AM Page 530 531 Chapter 25 ✦ Mail After all changes have been made to the aliases file, a database must be created for the mail server to read. This is done easily with the newaliases command. You must be in the directory of the aliases file, and then issue the command. If all the alias names and formats are correct, a database will be created; otherwise, you may receive error statements that necessitate correcting the file. Forwarding your mail Today, many people have more than one e-mail account through the Internet. To avoid confusion, all the mail from one system’s e-mail address can be redirected to an account on another system. This is known as forwarding. Forwarding e-mail is very useful. You may work in an environment with several servers running. These servers can be set up to automatically generate a report, which can be e-mailed to the adminis- trator of the mail server. The administrative account can then forward the mail to a central location, where the administrator can read the report. This enables the administrator to avoid logging on to each server to read the e-mail. Similarly, an individual user can forward mail from one e-mail address to another, be it on the same machine or to another system. Suppose that an individual is expecting an important e-mail message, but is going to be away on vacation. With one of the many available free Internet e-mail accounts, which can be accessed any- where, he or she can temporarily forward any messages. As with most text-based Internet tools, e-mail is also subject to security risks. Sending and receiving e-mail is not at all secure. There are some methods, how- ever, that can help to increase the security of e-mail messages, such as encrypting the message and using encryption keys. See Chapter 19 for more information on security. To forward your mail to another address, you must create a file in the home account location. Create the ~/.forward file and add a line with the e-mail address to which you would like the mail forwarded. For instance, if my e-mail address were jo@domain.com and I wanted to have my e-mail forwarded to jo@mydomain.com, I would do the following: $ vi ~/.forward In the file, I would add jo@mydomain.com, and then save and exit the editor. Now, whenever mail is sent to jo@domain.com, it will be forwarded to jo@mydomain.com instead. If you wish to cancel the forwarding, you can simply delete the ~/.forward file. Caution 4710-0 ch25.F 4/10/01 11:28 AM Page 531 532 Part V ✦ Linux Server Virtual mail server Virtual mail server is not a function that most individuals would want to use; however, for businesses that host Web pages, process e-mail, and provide other Internet-related services, it is an important one. The virtual mail server receives mail for a domain that doesn’t have a real machine. One method of working around this is to use the relay functions with the mail servers. This enables mail to be received on a mail server without the machine hav- ing the same domain name. The drawback to this method is that each address must have a unique name. Two domains with the same account ID will end up with mail going to the one account; for instance, jo@domain.com and jo@example.com will be treated as the same address. Alternatively, virtual mail server can be set up to receive mail addressed to anything@mydomain.com, which is routed to only one account. For instance, sup- pose mail sent to sale@mydomain.com and mail sent to debianrules@mydomain. com is routed to the account jo on the mail.domain.com machine. This way, Jo can pick up her mail whenever she wants. In other words, she can have mail sent to any name as long as it ends in @mydomain.com. In order to set up sendmail to route mail sent to anything for a domain, you must add a line to the /etc/mail/sendmail.cf file. Always make a back up copy of the configuration file before making any changes. Use an editor and locate section 98 (S98). If you are using vi as your editor, use the search command to find this sec- tion ( /S98). After this section identifier, add a line that looks like the following: R$* < $* domain.com. > $#local $@ $:username Replace domain.com with the name of the domain that will be virtually hosted. There must be a TAB between the two halves of the command. After R$* < $* domain.com. > , enter a TAB and then finish the line. Replace username with the account name to which the mail will be sent. If the TAB does not appear in the line, the virtual hosting will not work. Once you have edited the configuration file, restart the sendmail service. Following are the commands to accomplish this: # /etc/init.d/sendmail stop # /etc/init.d/sendmail start Sendmail will now be ready to receive mail from the new virtual domains. You can test mail sent to the new domains in the same way that you tested to see if sendmail worked initially. You should be able to send mail to any name as long as it is addressed to the virtually hosted domain. 4710-0 ch25.F 4/10/01 11:28 AM Page 532 533 Chapter 25 ✦ Mail DNS and Internet mail On the Internet or within a local network, where a Domain Name Server (DNS) is used to match domain names with actual IP addresses, mail is not handled in the same way. The DNS just wants to know the names of the mail exchangers; that is, the identities of the mail servers that can receive mail for a domain or forward it along. Each domain’s mail server, or mail exchanger, needs an MX (Mail Exchanger) record created for it. It also needs to be registered. If there is more than one mail exchanger for a domain, each MX record is weighted for priority. Even on a domain that has only one mail exchanger, that mail exchanger is still weighted with a priority. The number representing the priority can be anything from 0 to 65,535 (that’s a lot of mail servers). Lower numbers are taken to be a higher priority. For example, assume you have a network with a DNS. You have the mail services running on mail.domain.com, with the name of that machine registered in the DNS. You want all the mail for the domain domain.com to use mail.domain.com as the mail exchanger. You add an MX record to the DNS that would look like the following: domain.com IN MX 1 mail.domain.com. For larger facilities that require more than one mail server, add more servers, and then enter them in the DNS: domain.com IN MX 10 mail1.domain.com. domain.com IN MX 20 mail2.domain.com. domain.com IN MX 20 mail3.domain.com. Mail sent to domain.com using the preceding example would read the DNS as follows: 1. Mail would try to use the server with the lowest priority first— mail1.domain.com. 2. If mail.domain.com is unreachable, disconnected, or busy, then mail2.domain.com or mail3.domain.com would be tried next (both have the same priority). 3. The remaining two servers (mail2 and mail3) would be tried last. This scheme of MX records enables the use of secondary and backup mail servers. Because the names are registered in the DNS, these servers need not exist on the same network or location on the Internet. To learn more about the Domain Name Server, see Chapter 5. Cross- Reference 4710-0 ch25.F 4/10/01 11:28 AM Page 533 534 Part V ✦ Linux Server Using mailing lists Mailing list servers, commonly called list servers, automate the use of mailing lists, including distribution, subscriptions, and mailing requests— all without much human management. Computers can work much more efficiently than we can. Think of the list server as a dedicated program that monitors a mailbox for new mail. It then determines if incoming mail has a command associated with it or if it should be sent back to the subscribers of the list. Typically, the commands appear in the form of subscribe or unsubscribe requests. This automatically enables users to add or remove their e-mail address from a list. Other commands might include requests for specific documentation. Mailing lists are used everywhere as a common e-mail forum in which people to get help, share ideas, or, in some cases, just complain. And, yes, some mailing lists merely generate junk mail. Some e-mail claims to be from a mailing list when in fact it is just plain, old-fashioned spam (junk mail). The bottom of these messages gives a bogus e-mail address for you to unsubscribe, which only bounces back an error that no one exists at that address. Legitimate sites always respond to an unsub- scribe request. Debian uses many mailing lists. When you visit their Web site ( www.debian.org/ MailingLists ), you will see several mailing lists, all designed to enable people to communicate with one another on a variety of topics. There are lists for end users, developers, and specialty groups. Setting Up POP You were already introduced to the Post Office Protocol (POP) earlier in the chap- ter, but let’s review a few points. Because clients that use POP exist on nearly every platform, it has become the most popular protocol for picking up mail. The disad- vantages of using POP are that you have to get all your mail at one time and can use only one computer to do so. This limits your flexibility and mobility because you can’t read your downloaded mail on another machine. Moreover, POP reads only one folder on the mail server. Clients compensate for this by creating local folders in which you can read, sort, and manage your mail. Installing and configuring POP To begin, you must install a POP server on the mail server. Table 25-1, at the begin- ning of the chapter, lists the two POP servers that Debian provides in package form: ipopd and qpopper. By default, Debian installs the ipopd package, which works fine; however, qpopper has some enhanced features added. The packages are easy to install with dselect. The configuration stage of the install modifies the inetd.conf file so that the 110 TCP/IP port gets monitored for mail 4710-0 ch25.F 4/10/01 11:28 AM Page 534 535 Chapter 25 ✦ Mail requests. This is the official port for POP services. The configuration script adds the following line to the /etc/inetd.conf file (in this case, I installed qpopper instead of ipopd): pop-3 stream tcp nowait root /usr/sbin/tcpd /usr/sbin/in.qpopper If you make changes in the inetd.conf file, be sure to restart the inet service to activate the changes. Use the following command string to restart the service: # /etc/init.d/inetd stop # /etc/init.d/inetd start Testing POP With the POP service installed and running, you can now test the connection. Because POP uses a TCP/IP port, you can use telnet to connect to that port: # telnet localhost pop-3 Alternately, you can check the port from a remote computer; use the same com- mand, but replace localhost with the fully qualified domain name. You can also specify the port number (110) instead of using the name (pop-3). Here are the results of a connection to a server running qpopper as the POP server: $ telnet localhost pop-3 Trying 127.0.0.1 Connected to localhost. Escape character is ‘^]’. +OK QPOP (version 2.53) at debian.mydomain.com starting. <3008.965876676@debi an.rhino-tech.com> user jo +OK Password required for jo. pass foobar14 +OK jo has 0 messages (0 octets). quit +OK Pop server at debian.rhino-tech.com signing off. Connection closed by foreign host. $ The bold text in the preceding example shows the commands that you would need to use. I logged in using user jo. The account for jo had to be created before test- ing the POP server. The server then responded by asking for a confirmation in the form of a password. I then entered the password command (pass) and the pass- word. Note that the password is not encrypted for this test, so don’t use a critical account to do your testing (lest someone evil is watching in the background). Satisfied that the POP service was working properly, I issued the quit command to close the connection. The server then notified me that the connection was closed. 4710-0 ch25.F 4/10/01 11:28 AM Page 535 536 Part V ✦ Linux Server You can find out more about mail clients and retrieving mail in Chapter 6. Setting Up IMAP Although POP took off in the early days of computing, IMAP has found its niche as distributed computing has increased. IMAP users benefit from the capability to access more than one folder on the server, to mark mail as read or unread, and to leave mail on the server so that it is accessible from multiple machines. Because an IMAP system leaves the mail on the server, the mail is available to you whether you are traveling with a laptop, working at the office with a desktop, or checking in at home with your personal system. This is the major advantage to using IMAP. Installation and configuration IMAP installation and configuration is as easy as they come. Using dselect to install the imap package, the configuration script that is executed at the end makes all the needed changes. IMAP also uses the inetd service to watch the TCP/IP port. Here is the line the script adds to the /etc/inetd.conf file: imap2 stream tcp nowait root /usr/sbin/tcpd /usr/sbin/imapd You can make changes to this script, but I don’t advise it. The script automatically restarts the inet service; but if you need to restart the service for any reason, implement the following commands: # /etc/init.d/inetd stop # /etc/init.d/inetd start With the software installed and running, the IMAP service is activated anytime a request comes into the IMAP port. Testing IMAP Once installed, you’ll want to test the service to make sure that it works. This can be done through a terminal connection to the machine, either locally or remotely. Initiate the connection to the IMAP port with the following command line: telnet localhost imap2 This starts a connection to port 143 through TCP/IP, which is the IMAP port on your Debian machine. Alternatively, you can connect remotely by replacing localhost with the name or IP of the remote machine hosting the IMAP service. Cross- Reference 4710-0 ch25.F 4/10/01 11:28 AM Page 536 537 Chapter 25 ✦ Mail # telnet localhost imap2 Trying 127.0.0.1 Connected to localhost. Escape character is ‘^]’. * OK localhost IMAP4rev1 v12.264 server ready A001 login jo foobar14 A001 OK LOGIN completed A002 logout * BYE debian.domain.com IMAP4rev1 server terminating connection A002 OK LOGOUT completed Connection closed by foreign host. In the previous example, you can see the response of the IMAP server. The bold text shows what I entered. The A001 login told the IMAP server that someone wanted to log in. It then took the next entry as the user ID, followed by the password. These must be valid accounts and passwords or the server will respond with a login request. Once the server validates the login, it will respond with a confirmation that the login is complete. You can then log out of the IMAP server. Always keep the versions of all your servers up-to-date. Security holes are fixed quickly, but it won’t matter if you keep running the old buggy versions of software. See Chapter 19 for more details about security. Getting Help When you install mail serviceson your system, in most cases it should work. Of course, with no two machines alike, the potential for problems always exists. The following guidelines will help you troubleshoot any problems with mail: ✦ Make sure that you have an MX record in the DNS for each domain receiving mail. This entry should point to the machine that runs the mail server. ✦ Make sure that the /etc/mail/sendmail.cw file is properly configured if you are using sendmail. It contains all domains for which this server is responsi- ble for receiving mail. ✦ The alias file ( /etc/aliases or /etc/mail/aliases) should contain an entry for the postmaster, the mailer-daemon, or whatever name was set to receive error messages from the mail server. This name should be aliased to an administrator for the system. This will help to track down other problems. A good source for help is always other users, peers, and administrators. You can find great advice and helpful hints through Web sites, newsgroups, and mailing lists. If you visit www.debian.org/MailLists, you’ll find tons of mailing lists of knowledgeable people to help answer your questions. You might also find useful information at one of the Web sites focused on the vari- ous applications. Here are a few sites that might provide answers to your questions: Caution 4710-0 ch25.F 4/10/01 11:28 AM Page 537 538 Part V ✦ Linux Server ✦ www.exim.org — Site for the exim mail server ✦ www.sendmail.org — Site for the Open Source version of Sendmail ✦ www.imap.org — Site for the IMAP mail client server No matter what the problem, it’s likely that someone else has battled with it. Be sure to thoroughly explain your problem when posting to a mailing list or news- group, or enlisting online support through a Web site. Summary This chapter has been fairly comprehensive in covering topics regarding electronic mail. You have learned about several mail-related programs, some used for transfer- ring mail, and some used for retrieving mail. You’ve also learned about several mail- related concepts: ✦ MTA — A Mail Transfer Agent is a program that routes mail from system to sys- tem. These are the programs that actually deliver the mail to its destination. ✦ SMTP — Simple Mail Transfer Protocol is the language the MTA programs use to communicate in order to transfer the mail. These programs don’t have to be the same program; they just need to be able to speak SMTP. ✦ MUA — A Mail User Agent is a program that retrieves the mail. These are client applications, and are covered in Chapter 6. ✦ POP — Post Office Protocol is the protocol that the MUA applications use to retrieve the mail. This protocol enables users to get their mail and remove it from the server. POP limits users to one machine from which to read their mail. ✦ IMAP — Internet Mail Access Protocol enables users to access their mail on the server. Users can also leave their mail on the server, thus enabling them to access their mail from different machines and locations. This protocol also can mark the mail as read, unread, or deleted. It also can access more than one folder on the server, enabling users to manage their mail. Also covered in this chapter was the installation and configuration of two mail servers. The Debian packages include configuration scripts to help configure these packages for most situations. You also learned about some common e-mail topics, including forwarding mail, setting up aliases, and virtual hosting e-mail. These topics can help you with most SMTP programs that you choose to install. You also learned how to install two protocols that are used to retrieve mail from the server: POP and IMAP. In addition, you were also introduced to mailing list servers. You should now have the basic knowledge needed to set up and run your own mail server. Happy mailing. ✦✦✦ 4710-0 ch25.F 4/10/01 11:28 AM Page 538 What’s On the CD-ROM A ppendix A provides you with information on the con- tents of the CD-ROM that accompanies this book. There are 1,194 programs and supporting packages included on this CD. Among them are: ✦ Gnome Desktop Environment ✦ GIMP graphic design tool ✦ Apache Web Server Although Debian GNU/Linux offers its distribution for many platforms, the media that accompanies this book is only for the i386-based PC platform. Using the CD with Linux To install Debian GNU/Linux from the CD to your hard drive, follow the steps listed in Chapter 2 of this book. These instructions will thoroughly take you through the installation process. What’s On the CD The contents of this CD contain the core files for installing Debian GNU/Linux on your system. All software on this CD is free to use and free to copy under the GNU General Public License. The following summary shows some of the contents of the CD-ROM arranged by category. A A APPENDIX ✦✦✦✦ 4710-0 appA.F 4/10/01 11:28 AM Page 539 [...]... Management Protocol) Library linuxconf 1.17r5-2 A powerful Linux administration kit linuxconf-i18n 1.17r5-2 International language files for Linuxconf linuxconf-x 1.17r5-2 X11 GUI for Linuxconf loadlin 1.6a-4 A loader (running under DOS) for LINUX kernel images locale-ja 14 Locale definition files for Japanese Continued 5 59 4710-0 appC.F 560 4/10/01 11:28 AM Page 560 Debian GNU/ Linux Bible Table C-1 (continued)... Canna DL module for emacs20-dl emacs-dl-wnn 0.4.1 -9 Wnn DL module for emacs20-dl emacs 19 19. 34-26.5 The GNU Emacs editor emacs 19- el 19. 34-26.5 GNU Emacs LISP (.el) files emacs20 20.7-2 The GNU Emacs editor emacs20-dl 20.7-4 The GNU Emacs editor (dynamic Loading supported) emacs20-dl-el 20.7-4 GNU Emacs LISP (.el) files (for emacs20-dl) emacs20-el 20.7-2 GNU Emacs LISP (.el) files emacsen-common 1.4.12... 0.72 -9 Pluggable Authentication Modules for PAM libpam-runtime 0.72 -9 Runtime support for the PAM library libpam0g 0.72 -9 Pluggable Authentication Modules library libreadline4 4.1-1 GNU readline and history libraries, runtime libraries libstdc++2.10 1:2 .95 .2-13 The GNU stdc++ library libwrap0 7.6-4 Wietse Venema’s TCP wrappers library lilo 1:21.4.3-2 LInux LOader — The Classic OS loader can load Linux. .. login 199 90827-20 System login tools makedev 2.3.1-44 Creates special device files in /dev mawk 1.3.3-5 A pattern scanning and text processing language Continued 563 4710-0 appC.F 564 4/10/01 11:28 AM Page 564 Debian GNU/ Linux Bible Table C-2 (continued) Package Description mbr 1.1.2-1 Master Boot Record for IBM-PC compatible computers modconf 0.2.26.14 Device driver configuration modutils 2.3.11-8 Linux. .. Cursor-based disk partition table manipulator for Linux cfdisk [ OPTION ] [ device ] 545 4710-0 appB.F 546 4/10/01 11:28 AM Page 546 Debian GNU/ Linux Bible /sbin/fdisk — Partition table manipulator for Linux fdisk [-u] [-b sectorsize] device sfdisk — Partition table manipulator for Linux sfdisk [OPTION] device /sbin/fsck — A file system consistency checker for Linux fsck [OPTION] [-t fstype] [ ] [fsck-options]... 2.2.0 Debian base system miscellaneous files base-passwd 3.1.7 Debian Base System Password/Group Files bash 2.03-6 The GNU Bourne Again SHell bsdutils 1:2.10f-5.1 Basic utilities from 4.4BSD-Lite console-tools 1:0.2.3-10.3 Linux console and font utilities console-tools-libs 1:0.2.3-10.3 Shared libraries for Linux console and font manipulation debianutils 1.13.3 Miscellaneous utilities specific to Debian. .. networking binaries passwd 199 90827-20 Change and administer password and group data pcmcia-cs 3.1.8-16 PCMCIA Card Services for Linux pcmcia-modules2.2.17 3.1.8-14+ 2.2.17pre6+1 PCMCIA Modules for Linux (kernel 2.2.17) pcmcia-modules-2.2.17compact 3.1.8-14+ 2.2.17pre6+1 PCMCIA Modules for Linux (kernel 2.2.17-compact) pcmcia-modules2.2.17-ide 3.1.8-14+ 2.2.17pre6+1 PCMCIA Modules for Linux (kernel 2.2.17-ide)... AM Page 562 Debian GNU/ Linux Bible Base utilities Base utilities, shown in Table C-2, includes the basic utilities needed of every Debian system (You needn’t install these utilities Most are installed as parts of the base systms.) Table C-2 Base utilities Package Description adduser 3.11.1 Add users and groups to the system ae 96 2-26 Anthony’s Editor — a tiny full-screen editor apt 0.3. 19 Advanced front-end... files related to Linux kernel version 2.0.38 kernel-image-2.0.38 2.0.38-3 Linux kernel binary image for version 2.0.38 kernel-image-2.2.17 2.2.17pre6-1 Linux kernel binary image for version 2.2.17 kernel-image2.2.17-compact 2.2.17pre6-1 Linux kernel binary image kernel-image-2.2.17-ide 2.2.17pre6-1 Linux kernel binary image for version 2.2.17 kernel-image-2.2.17-idepci 2.2.17pre6-1 Linux kernel binary... of those who have sent mail from [-s sender] [-f file] [user] /usr/bin/getopt — Parse command options (enhanced) getopt [OPTIONS] [ ] optstring parameter 5 49 4710-0 appB.F 550 4/10/01 11:28 AM Page 550 Debian GNU/ Linux Bible /usr/bin/gettext — GNU gettext utilities gettext [OPTION] [[[TEXTDOMAIN] MSGID] | [-s [MSGID] ]] /usr/bin/groff — Front end for the groff document formatting system groff [ OPTIONS][ . table manipulator for Linux cfdisk [ OPTION ] [ device ] 4710-0 appB.F 4/10/01 11:28 AM Page 545 546 Debian GNU/ Linux Bible /sbin/fdisk — Partition table manipulator for Linux fdisk [-u] [-b. [OPTIONS] [ ] optstring parameter 4710-0 appB.F 4/10/01 11:28 AM Page 5 49 550 Debian GNU/ Linux Bible /usr/bin/gettext — GNU gettext utilities gettext [OPTION] [[[TEXTDOMAIN] MSGID] | [-s [MSGID]. CD-ROM arranged by category. A A APPENDIX ✦✦✦✦ 4710-0 appA.F 4/10/01 11:28 AM Page 5 39 540 Debian GNU/ Linux Bible Applications The following applications are on the CD-ROM: Graphical interfaces A

Ngày đăng: 14/08/2014, 04:21

TỪ KHÓA LIÊN QUAN