ubuntu mail 服务器,ubuntu服务器版安装
大家好,关于ubuntu mail 服务器很多朋友都还不太明白,不过没关系,因为今天小编就来为大家分享关于ubuntu服务器版安装的知识点,相信应该可以解决大家的一些困惑和问题,如果碰巧可以解决您的问题,还望关注下本站哦,希望对各位有所帮助!
如何在ubuntu中安装设置ftp服务器
方法/步骤
1
首先,更新软件源,保证源是最新的,这样有利于下面在线通过apt-get install命令安装ftp。
2
使用sudo apt-get install vsftp命令安装vsftp,安装软件需要root权限,我们使用sudo来暂时获取。
3
安装好ftp后默认是会自动创建ftp用户的,然后我们设置ftp用户的密码,输入
sudo passwd ftp,然后输入密码,再确认密码。
4
创建ftp用户的家目录,使用sudo mkdir/home/ftp命令
5
设置ftp家目录的权限,我这里为方便直接使用sudo chmod 777/home/ftp命令将权限设置为777,当然你可以根据自己需求进行设置。
6
对/etc/vsftpd.conf配置文件进行一定的修改。使用 sudo gedit/etc/vsftpd.conf打开配置文件,如果你喜欢vi或vim编辑器也可以使用它们打开。
7
将配置文件中”anonymous_enable=YES“改为“anonymous_enable=NO”(是否允许匿名ftp,若不允许选NO)
取消如下配置前的注释符号:
local_enable=YES(是否允许本地用户登录)
write_enable=YES(是否允许本地用户写的权限)
chroot_local_user=YES(是否将所有用户限制在主目录)
chroot_list_enable=YES(是否启动限制用户的名单)
chroot_list_file=/etc/vsftpd.chroot_list(可在文件中设置多个账号)
8
然后重启ftp服务,使用命令sudo service vsftpd restart重启ftp服务。
9
测试ftp,复制一些文件到/home/ftp目录下
方法一:在浏览器中输入,网页登录。
方法二:在终端中输入ftp localhost,然后输入用户名与密码实现登录。
10
如果登录ftp总是出现密码错误,可以将/etc/vsftpd.conf配置文件的pam_service_name=vsftpd改为pam_service_name=ftp,即可解决。
如何在Ubuntu或者Debian设置邮件服务器
1.先决条件
每个域必须有一个DNS服务器。建议不要使用Live域用于测试目的。在本教程中,将在实验室环境中使用测试域example.tst。在这个假设域名的DNS服务器应该在至少以下记录。
example.tst的forward zone配置:
IN MX 10 mail.example.tst.
mail.example.tst. IN A 192.168.10.1
example.tst的Reverse zone配置:
192.168.10.1 IN PTR mail.example.tst.
在配置邮件服务器的过程中,这些记录可以根据系统的要求进行修改。
2.设置主机名
首先,必须在/etc/hostname和/etc/hosts文件中指定邮件服务器的主机名。前者应仅包含主机名。
root@mail:~# vim/etc/hostname
root@mail:~# vim/etc/hosts
## IP Fully Qualified Domain Name Hostname##
192.168.10.1 mail.example.tst mail
增加用户
每一个Linux用户,在默认情况下,系统会为其自动创建一个邮箱。这些用户和邮箱将被用作电子邮件帐户和它们各自的邮箱。创建一个用户是很容易的。
root@mail:~# adduser fourbyte
安装和配置SMTP
服务: postfix
配置文件路径/etc/postfix/
执行脚本/etc/init.d/postfix
日志文件/var/log/mail.log
端口 TCP/25
SMTP:安装postfix
postfix是广泛使用的SMTP服务器之一,因为它是稳定的、轻量级的、可扩展的、高度可定制的。安装postfix可以使用apt-get的完成。
root@mail:~# apt-get install postfix
在安装过程中,需要指定电子邮件服务器和域名的类型。
由于此邮件服务器就会直接向目的地发送电子邮件,我们选择Internet Site。
邮件服务器的域名也需要配置,这可以从确保该邮件服务器发送的所有邮件都有@ example.tst作为发件人域。
postfix的配置文件存储在/etc/postfix目录。下面的配置文件是非常重要的。他们中的一些可能不存在,因此需要手动创建。
transport:主要用于定义邮件如何被路由到特定的目标域。绕过DNS查询可以是一个很好的例子。在这种情况下,人们可以发送到域XYZ.com的电子邮件直接通过IP地址XYYX不考虑任何DNS查询的结果。
access:可用于安全目的,如阻止发件人/收件人和他们的域名。
aliases:用于定义用户别名。例如,发送到userA的邮件可以由userB和userC接收。
main.cf:是postfix的配置文件。
SMTP:准备配置文件
差不多可以准备配置文件了。transport与aliases配置文件没有默认提供,需要手动创建。
root@mail:~# cd/etc/postfix
root@mail:/etc/postfix# touch transport aliases
main.cf
首先需要备份main.cf然后再进行修改。根据下面的配置添加或修改配置文件。有关参数的更多详细信息,请参阅官方README和配置手册。
root@mail:/etc/postfix# vim main.cf
## the name of the server##
myhostname= mail.example.tst
## alias definitions##
alias_maps= hash:/etc/postfix/aliases
alias_database= hash:/etc/postfix/aliases
## transport definition##
transport_maps= hash:/etc/postfix/transport
## myorigin defines the domain name for emails originated from this server. In this case, all outgoing mail should have'@example.tst' as sender domain##
myorigin= example.tst
## mydestination parameter specifies what domains this machine will deliver locally, instead of forwarding to another machine.##
mydestination= mail.example.tst, localhost.example.tst, localhost, hash:/etc/postfix/transport
## the smarthost address. Not used in this tutorial and will be covered in the future##
relayhost=
## the trusted sender networks. postfix will not forward mails originated from other subnets##
mynetworks= 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 192.168.10.0/24
## mailbox size in bytes. 0 denotes no limit##
mailbox_size_limit= 0
## postfix will listen on all available interfaces i.e. eth0, eth1, eth2 and so on##
inet_interfaces= all
transport
邮件域example.tst被定义为在本地传递不需要任何DNS查询。
root@mail:/etc/postfix# vim transport
example.tst local:
.example.tst local:
root@mail:/etc/postfix# postmap transport
aliases
假设所有发送到userA的所有电子邮件可以由userB接收,别名文件需要按如下所述进行修改。
ubuntu中配置sendmail,在线等
sendmail.cf是Sendmail的配置文件,它全权决定了Sendmail的属性。这个文件定义邮件服务器为哪个域工作。其中的内容为特定宏,大多数人对它都抱有恐惧心理,因为文件中的宏代码实在是太多。sendmail.cf通常是由一个以mc结尾的文件编译产生。如Redhat自带一个redhat.mc,用户可以自己修改其中的一些设置,使之适合自己。笔者的sendmail.mc文件内容如下:
divert(-1)
dnl This is the macro config file used to generate the/etc/sendmail.cf
dnl file. If you modify thei file you will have to regenerate the
dnl/etc/sendmail.cf by running this macro config through the m4
dnl preprocessor:
dnl m4/etc/sendmail.mc>/etc/sendmail.cf
dnl You will need to have the Sendmail-cf package installed for this to work.
include(`/usr/lib/Sendmail-cf/m4/cf.m4')
define(`confDEF_USER_ID',``8:12'')
OSTYPE(`Linux')
undefine(`UUCP_RELAY')
undefine(`BITNET_RELAY')
define(`confAUTO_REBUILD')
define(`confTO_CONNECT', `1m')
define(`confTRY_NULL_MX_LIST',true)
define(`confDONT_PROBE_INTERFACES',true)
define(`PROCMAIL_MAILER_PATH',`/usr/bin/procmail')
FEATURE(`smrsh',`/usr/sbin/smrsh')
FEATURE(`mailertable',`hash-o/etc/mail/mailertable')
FEATURE(`virtusertable',`hash-o/etc/mail/virtusertable')
FEATURE(redirect)
FEATURE(always_add_domain)
FEATURE(use_cw_file)
FEATURE(local_procmail)
MAILER(smtp)
MAILER(procmail)
FEATURE(`access_db')
FEATURE(`blacklist_recipients')
dnl We strongly recommend to comment this one out if you want to protect
dnl yourself from spam. However, the laptop and users on computers that do
dnl not hav 24x7 DNS do need this.
FEATURE(`accept_unresolvable_domains')
dnl FEATURE(`relay_based_on_MX')
编译sendmail.mc以产生需要的sendmail.cf文件:# m4/etc/sendmail.mc>/etc/mail/sendmail.cf。
生成sendmail.cf以后,编辑sendmail.cf。在文件中,查找DS,在其后加入邮件服务器名、域名,这样可以保证当你以username@mail.domain.com或username@domain.com发信时,用户都可以收到,如下所示:
# Alias for this host
Cw mail.domain.com domain.com
然后,就可以启动Sendmail了:#/usr/sbin/Sendmail-bd-q20m。
Sendmail 8.9.x以后的版本,在缺省情况下,都默认不对未验证的计算机进行转发(Relay),所以如果要为本机以外的其他计算机进行邮件转发,这时,应该在相应的配置文件中明确告诉Sendmail要对哪几个主机进行转发。如果不考虑验证,对任何主机都进行转发的话,可以在sedmail.mc文件中加入一行:FEATURE(promiscuous_relay)。
不过,如果你的计算机是放在公网上的话,建议你不要这样做,因为这样做了以后,任何人都可以使用你的计算机进行转发邮件了,特别是一些别有用心的人或一些兜售客(spammer,垃圾邮件制造者)会利用你的邮件服务器的转发功能乱发大量的垃圾邮件。
使用说明
通常情况下,Sendmail不会为邮件服务Relay信息,这样可以防止一些有恶意的人利用别人的邮件服务器乱发邮件。缺省情况下,Sendmail关闭了Relay功能。如果你要为别的服务器Relay邮件,可以进行如下设置——在access文件中加入要为其Relay信件的机器,格式为:
hostname RELAY
ipaddress RELAY
如果要为一个域内多个机器Relay信件,则可以在/etc/mail/access文件中直接加入其子网IP或域名,如下所示:
access文件内容:
domainname.com RELAY(允许为域domainname的所有计算机relay邮件)
localhost RELAY
192.168.1.0 RELAY(为192.168.1.0此网内所有机器relay邮件)
此文件惟一决定了哪些机器、哪个域可以使用邮件服务器转发邮件。完成后需要进行编译:#makemap hash access.db< access。
其他配置的文件关系不是很大,可以暂时使用缺省安装的内容。至此,Sendmail应该可以正常工作了。
接下来是测试邮件服务器的邮件发送功能,注意:测试时,不要只对本地用户进行测试,如:你的域为abc.com,测试时,不要只在邮件服务器上测试user1@abc.com用户。因为,此时user1是本地用户,所以邮件服务器可以对其进行Relay。你应该从局域网上的另一台机器使用Outlook等邮件客户端对服务器进行测试。