●08-12.FTPサーバー構築(vsftpd)
ファイル・サーバーの構築です。
レンタルサーバーでは既に設定済みです。
管理ツールでクライアント・ソフト無しでファイル管理ができる場合があります。
・インストール
[root@fedora ~]# yum -y install vsftpd vsftpdインストール
・設定
[root@fedora ~]# vi /etc/vsftpd/vsftpd.conf vsftpd設定ファイル編集
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=NO anonymousユーザのログイン禁止
# Activate logging of uploads/downloads.
xferlog_enable=YES /var/log/vsftpd.logに接続・転送を記録
# You may override where the log file goes if you like. The
default is shown
# below.
xferlog_file=/var/log/vsftpd.log /var/log/vsftpd.logに接続・転送を記録
# If you want, you can have your log file in standard ftpd xferlog
format
xferlog_std_format=NO /var/log/vsftpd.logに接続・転送を記録
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
ascii_upload_enable=YES アスキーモードでのアップロードを許可
ascii_download_enable=YES アスキーモードでのダウンロードを許可
# You may fully customise the login banner string:
ftpd_banner=Welcome to blah FTP service. FTPログイン時にソフト名とバージョンが表示されないようにする
# You may specify an explicit list of local users to chroot()
to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
chroot_local_user=YES デフォルトでホームディレクトリより上層へのアクセスを禁止する
chroot_list_enable=YES ホームディレクトリより上層へのアクセスを許可するユーザのリストの有効化
# (default follows)
chroot_list_file=/etc/vsftpd/chroot_list ホームディレクトリより上層へのアクセスを許可するユーザのリスト
# sites. However, some broken FTP clients such as "ncftp" and "mirror"
assume
# the presence of the "-R" option, so there is a strong case for enabling
it.
ls_recurse_enable=YES ディレクトリごと削除できるようにする
以下を最下行へ追加
use_localtime=YES タイムスタンプ時間を日本時間にする
・起動
[root@fedora ~]# /etc/rc.d/init.d/vsftpd start vsftpd起動
vsftpd 用の vsftpd を起動中: [ OK ]
[root@fedora ~]# chkconfig vsftpd on vsftpd自動起動設定
●08-13.メールサーバー構築(Postfix+Dovecot)
通常レンタルしているサーバーではインストールの必要は無いでしょう。
・Postfixインストール
[root@fedora ~]# yum -y install postfix
・Postfix設定
[root@fedora ~]# vi /etc/postfix/main.cf Postfix設定ファイル編集
# INTERNET HOST AND DOMAIN NAMES
#
# other configuration parameters.
#
#myhostname = host.domain.tld
#myhostname = virtual.domain.tld
myhostname = fedora.fedorasrv.com 追加(自FQDN名を指定)
# The mydomain parameter specifies the local internet domain
name.
# The default is to use $myhostname minus the first component.
# $mydomain is used as a default value for many other configuration
# parameters.
#
#mydomain = domain.tld
mydomain = fedorasrv.com 追加(自ドメイン名を指定)
# SENDING MAIL
#
# The myorigin parameter specifies the domain that locally-posted
# user@that.users.mailhost.
#
# For the sake of consistency between sender and recipient addresses,
# myorigin also specifies the default domain name that is appended
# to recipient addresses that have no @domain part.
#
#myorigin = $myhostname
#myorigin = $mydomain
myorigin = $mydomain 追加(ローカルからのメール送信時の送信元メールアドレス@以降にドメイン名を付加)
# The inet_interfaces parameter specifies the network interface
# addresses that this mail system receives mail on. By default,
#
# Note: you need to stop/start Postfix when this parameter changes.
#
#inet_interfaces = all
#inet_interfaces = $myhostname
#inet_interfaces = $myhostname, localhost
inet_interfaces = localhost
↓
inet_interfaces = all 変更(外部からのメール受信を許可)
# The mydestination parameter specifies the list of domains
that this# machine considers itself the final destination for.
#
# These domains are routed to the delivery agent specified with the
# local_transport parameter setting. By default, that is the UNIX
# Continue long lines by starting the next line with whitespace.
#
# See also below, section "REJECTING MAIL FOR UNKNOWN LOCAL USERS".
#
mydestination = $myhostname, localhost.$mydomain, localhost
↓
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
変更(自ドメイン宛メールを受信できるようにする)
#mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
#mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain,
# mail.$mydomain, www.$mydomain, ftp.$mydomain
# DELIVERY TO MAILBOX
#
# The home_mailbox parameter specifies the optional pathname of a
# mailbox file relative to a user's home directory. The default
# mailbox file is /var/spool/mail/user or /var/mail/user. Specify
# "Maildir/" for qmail-style delivery (the / is required).
#
#home_mailbox = Mailbox
#home_mailbox = Maildir/
home_mailbox = Maildir/ 追加(メールボックス形式をMaildir形式にする)
# SHOW SOFTWARE VERSION OR NOT
#
# The smtpd_banner parameter specifies the text that follows the 220
# RFC requirement. Postfix itself does not care.
#
#smtpd_banner = $myhostname ESMTP $mail_name
#smtpd_banner = $myhostname ESMTP $mail_name ($mail_version)
smtpd_banner = $myhostname ESMTP unknown 追加(メールサーバーソフト名の隠蔽化)
Postfix起動
[root@fedora ~]# /etc/rc.d/init.d/postfix start Postfix起動
postfix を起動中: [ OK ]
[root@fedora ~]# chkconfig postfix on Postfix自動起動設定
・Dovecotインストール
yum -y install dovecot
・Dovecot設定
[root@fedora ~]# vi /etc/dovecot.conf Dovecot設定ファイル編集
# Protocols we want to be serving: imap imaps pop3 pop3s
# If you only want to use dovecot-auth, you can set this to "none".
#protocols = imap imaps pop3 pop3s
protocols = imap imaps pop3 pop3s 追加
# Location for users' mailboxes. This is the same as the old
default_mail_env
# setting. The default is empty, which means that Dovecot tries to find the
# directory", and it must be the first path given in the mail_location setting.
#
# There are a few special variables you can use, eg.:
#
# %u - username
# %n - user part in user@domain, same as %u if there's no domain
# %d - domain part in user@domain, empty if there's no domain
# %h - home directory
#
# See doc/variables.txt for full list. Some examples:
#
# mail_location = maildir:~/Maildir
# mail_location = mbox:~/mail:INBOX=/var/mail/%u
# mail_location = mbox:/var/mail/%d/%1n/%n:INDEX=/var/indexes/%d/%1n/%n
#
# http://wiki.dovecot.org/MailLocation
#
#mail_location =
mail_location = maildir:~/Maildir 追加(メールボックス形式をMaildir形式とする)
default_mail_env = maildir:~/Maildir 追加(メールボックス形式をMaildir形式とする)
# ':' separated list of directories under which chrooting is
allowed for mail
# processes (ie. /var/mail will allow chrooting to /var/mail/foo/bar too).
# allow shell access for users. See doc/configuration.txt for more information.
#valid_chroot_dirs =
・Dovecot起動
[root@fedora ~]# /etc/rc.d/init.d/dovecot start Dovecot起動
Dovecot Imapを起動中: [ OK ]
[root@fedora ~]# chkconfig dovecot on Dovecot自動起動設定
戻る
|