• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            旅途

            如果想飛得高,就該把地平線忘掉

            LINUX下FTP的搭建-wuftp

            FTP服務器的安裝及管理-wuftp

            說明:
            Linux下一般最常用的工具wu-ftpd.

            wu-ftpd的安裝非常容易,大多數版本的Linux中都包含了wu-ftpd的rpm軟件包,你可以在安裝Linux時指定裝入。如果你想自行編譯源代碼,也可以到ftp://ftp.wu-ftpd.org下載最新版本的源代碼包。

            安裝好以后,可以用ckconfig命令來檢查是否已經正確安裝。在/etc/passwd中可以指定ftp用戶的登入目錄。

            wu-ftpd主要有以下6個配置文件:

            ftpaccess(主要配置文件,控制存取權限)

            ftpconvertions(配置文件壓縮/解壓縮轉換)

            ftpgroups(設定ftp自己定義的群組)

            ftphosts(設定個別的用戶權限)

            ftpservers(設定不同IP/Domain Name以對應到不同的虛擬主機)

            ftpusers(設定哪些帳號不能用ftp連線)


            一. ftp服務器
            1. inetd配置文件或xinetd.conf配置文件
            /etc/inetd.conf文件內容如下:
            ftp stream tcp nowait root /usr/sbin/tcpd in.ftpd -l -a

            /etc/xinetd.conf文件內容如下:
            service ftp
            {
            socket_type = stream
            protocol = tcp
            wait = no
            user = root
            #only_from = 202.118.66.0
            #only_from += 192.168.1.2
            #only_from += localhost
            server = /usr/sbin/in.ftpd
            server_args = -l -a
            }


            相關文件:/etc/services
            ftp-data 20/tcp
            ftp 21/tcp

            2. ftp用戶(Anonymous FTP服務器需要用到)
            文件:/etc/passwd和/etc/shadow

            /etc/passwd:
            ftp:x:500:50:Anonymous FTP User:/home/ftp:/bin/false

            /etc/shadow:
            ftp:*:10689:0:99999:7:::

            $finger ftp
            Login: ftp Name: FTP User
            Directory: /home/ftp Shell: /bin/false
            Never logged in.
            No mail.
            No Plan.

            3. DNS配置
            ftp IN CNAME officail.domain.name.

            4. 管理員郵件別名
            文件: /etc/mail/aliases (Solairs)
            /etc/aliases (Linux)
            (egrep aliases /etc/mail/sendmail.cf )

            ftp-admin: real-user-name@domain.name

            相關命令: newaliases, 建立郵件別名


            二. 文件系統結構
            1. Anonymous FTP 目錄結構
            如下子目錄:
            bin(ls,gzip,tar等anonymous ftp用戶所要使用的二進制可執行文件)
            etc(passwd,group)
            lib(動態連接庫,ld-2.0.7.so, ld-linux.so.2, ldd ../bin/ls 等)
            pub(可下載文件)

            2. passwd及group文件
            不要使用系統的passwd及group文件,最好只放所需的用戶及組信息
            passwd文件:
            ftpadm:x:0:0:Anonymous FTP:/home/ftp:/bin/false
            ftp:x:60000:60000:Anonymous FTP:/home/ftp:/bin/false
            group文件:
            ftpadmin:x:0:
            ftp:x:60000:

            3. 文件及目錄屬性
            主目錄/home/ftp 屬主root, 屬性555
            bin 屬主root 組wheel或other, 屬性111
            etc 同上
            lib 屬主root, 屬性555
            pub 屬主為root或ftp管理員,屬性555

            確認不要用ftp作任何文件或目錄的屬主!

            [hbwork@helius /etc]$ cd /home/ftp/
            [hbwork@helius ftp]$ ls -l
            total 4
            d--x--x--x 2 root root 1024 Apr 8 17:57 bin
            d--x--x--x 2 root root 1024 Jun 4 15:12 etc
            drwxr-xr-x 2 root root 1024 Apr 8 17:57 lib
            dr-xr-sr-x 2 root ftp 1024 Apr 8 11:18 pub

            $ls -l bin
            [root@helius ftp]# ls -l bin/
            total 250
            ---x--x--x 1 root root 15236 Apr 28 1998 compress
            ---x--x--x 1 root root 46356 Sep 11 1998 cpio
            ---x--x--x 1 root root 45436 Sep 11 1998 gzip
            ---x--x--x 1 root root 29980 Sep 11 1998 ls
            ---x--x--x 1 root root 110668 Sep 11 1998 tar
            lrwxrwxrwx 1 root root 4 May 19 16:48 zcat -> gzip

            $ls -l etc
            total 19
            -r--r--r-- 1 root root 57 Jun 4 15:12 group
            -r--r--r-- 1 root root 16372 Sep 11 1998 ld.so.cache
            -r--r--r-- 1 root root 83 Jun 4 15:12 passwd

            (在Solaris上建立anonymouse FTP特殊一些,請參考Wu-ftpd-faq)


            4. 可選目錄
            incoming Owner: root Mode:1733 (chmod 1733 incoming)

            三. 測試及調試
            egrep ftp /etc/inetd.conf
            ps ax |egrep inetd
            kill -HUP $PID

            $ftp localhost (or ftp 0)
            執行ls cd get 等指令看一下結果如何


            四. wu-ftpd FTP服務器進程

            增強功能:
            . 允許根據用戶的ip地址或主機,用戶名設置不同的類
            . 根據設置的類,管理員可以控制其訪問權限,如防止anonymous用戶
            刪除文件或覆蓋已有的文件
            . 可以實現自動執行uncompress,compress,tar,gzip等功能
            . 可以記載所有的upload/download,及ftp client所發送的每個命令.
            . 允許平滑關掉ftp服務器

            相關配置文件:
            ftpaccess
            ftpconversions
            ftphosts
            ftpuser

            相關命令:
            strings /usr/sbin/in.ftpd |egrep ftpaccess

            1. 編譯 wu-ftpd

            最新版本: wu-ftpd-2.5.0
            ftp://ftp.dlut.edu.cn/pub/unix/ftp/servers/

            $tar -zxvf wu-ftpd-2.5.0.tar.gz
            $cd wu-ftpd-2.5.0
            建議在編譯安裝之前參考文件INSTALL,README,upload.configuration.HOWTO
            如想定制自己的wu-ftpd,可編輯文件src/pathnames.h
            $build help
            查看編譯幫助

            $./build lnx
            $su
            #./build install

            2. 命令行選項
            -d Sends debugging information to syslog
            -a Enable the use of the ftpaccess file(This is the default)
            -A Disable the use of the ftpaccess file
            -L Cause ftpd to log all USER commands.
            -i Causes ftpd to log all incoming(upload) file in the xferlog
            file( See pathnames.h )
            -o Causes ftpd to log all outgoing(download) files in the xferlog file

            3. 文件ftpconversions
            doc/examples/, 用于指定get時的實時壓縮或展開(on-the-fly).

            此文件不般情況下不用作修改

            4. ftpaccess
            (1)定義類
            三種用戶類型: real anonymous
            guest(需要提供相應的口令)
            格式:
            class classname type[,type,...] address [ address ...]

            示例:
            class local real *.dlut.edu.cn 202.118.66 localhost
            class anonymous anonymous *


            (2)拒絕訪問
            deny *.net.cn /etc/ftpmsgs/msg.denied

            (3)限制訪問
            limit class number times messages

            limit anonymous 200 SaSu
            limit anonymous 100 Any /etc/ftpmsgs/msg.toomany


            loginfails 2
            tar no anonymous
            compress no anonymous

            chmod yes|no type [type ...]
            delete yes|no type [type ...]
            overwrite yes|no type [type ...]
            rename yes|no type [type ...]
            umask yes|no type [type ...]

            passwd-check none|trivial|rfc822 enforce|warn

            (5)banner
            顯示在用戶login之前的信息
            banner /etc/ftpmsg/banner.msg

            其中banner.msg文件中可以引用如下變量:
            %C Current working directory
            %E Email address of the administrator( email ftpadm@dlut.edu.cn)
            %F 可當目錄下可用空間
            %L hostname
            %M 最大允許連接數
            %N 同一類中當前連接數
            %R The client host'name or ip address
            %T Current local time
            %U The name the user specified at login

            示例文件:
            Welcome to this test FTP Archive, running on %L.

            Please contact %E with any technical problems you may have
            accessing this archive.

            You are currently user %N out of a maximum %M users. It's
            %T in PRC.

            (6)message命令
            message pathname login
            message pathname cwd=dir
            message .conents cwd=*
            每改變目錄均顯示,cwd=dir只在第一次更改時顯示

            (7)readme命令
            readme pathname [login|cwd=dir] [class] [class]

            readme README* cwd=*

            (8)shutdown命令 (2.5.0上不正常)
            shutdown pathname

            (9)log命令

            log commands type [ type ...]

            log transfer type [type ...] direction[,direction]

            (10)alias
            alias source: /pub/local/sw/source

            (11)cdpath
            cdpath /pub /pub1

            上載控制
            upload hierarchy directory yes|no owner group mode [dirs|nodirs]

            下面的wu-ftpd-2.5.0 /etc/ftpaccess文件中的upload配置(大家可以試一下大工FTP
            服務器的upload,但別傳沒用的過大的文件)

            # FTP-home-dir archiv-dir allow? owner group mode dirs?
            # (as in /etc/passwd)

            upload /home/ftp * no
            upload /home/ftp /pub3/incoming/windows yes ftpadmin ftp 0664 dirs
            upload /home/ftp /pub3/incoming/windows/* yes ftpadmin ftp 0664 dirs
            upload /home/ftp /pub3/incoming/unix yes ftpadmin ftp 0666 dirs
            upload /home/ftp /pub3/incoming/unix/* yes ftpadmin ftp 0666 dirs
            upload /home/ftp /pub3/incoming/other yes ftpadmin ftp 0666 dirs
            upload /home/ftp /pub3/incoming/other/* yes ftpadmin ftp 0666 dirs
            upload /home/ftp /pub3/incoming/WDI yes ftpadmin ftp 0666 dirs
            upload /home/ftp /pub3/incoming/WDI/* yes ftpadmin ftp 0666 dirs


            5. ftphosts文件
            allow ftp *.dlut.edu.cn
            allow anonymous *.dlut.edu.cn
            deny ftp *.dlmu.edu.cn
            deny ftp *.dlmu.edu.cn 202.118.80.*


            6.實用程序

            ftpcount
            ftpwho
            ftushut

            維護:
            建立連接時最好使用相對路徑。
            根據軟件類別建立不同的子目錄。
            最好在每個目錄中建立相應的說明文件或index文件,方便用戶查找。

            posted on 2010-03-14 14:27 旅途 閱讀(1840) 評論(0)  編輯 收藏 引用 所屬分類: LINUX基礎、管理

            99久久久国产精品免费无卡顿| 嫩草影院久久99| 久久乐国产综合亚洲精品| 热RE99久久精品国产66热| 合区精品久久久中文字幕一区 | 亚洲色大成网站WWW久久九九| 久久国产免费直播| 99久久无色码中文字幕| 久久久久九国产精品| 午夜人妻久久久久久久久| 欧美亚洲国产精品久久蜜芽| 亚洲精品高清一二区久久| 久久久久亚洲精品无码蜜桃| 久久久精品国产亚洲成人满18免费网站| 2021最新久久久视精品爱| 人人狠狠综合久久亚洲88| 亚洲午夜久久久久妓女影院 | 久久久久亚洲精品无码网址 | 国内精品久久久久久野外| 久久久这里有精品| 99久久国产亚洲高清观看2024| 亚洲色欲久久久综合网东京热 | 久久精品国产精品亚洲精品| 日韩亚洲欧美久久久www综合网| 日本五月天婷久久网站| 久久精品国产精品亚洲艾草网美妙| 无码超乳爆乳中文字幕久久| 久久伊人五月天论坛| 久久天堂电影网| 国产亚洲欧美成人久久片| 三上悠亚久久精品| 亚洲中文字幕无码久久综合网| 久久国产美女免费观看精品| 国产成人99久久亚洲综合精品| 国内精品久久九九国产精品| 精品久久久久久无码专区| 久久w5ww成w人免费| 99热成人精品热久久669| 精品国产福利久久久| 久久综合久久综合久久| 国产69精品久久久久9999|