• <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服務(wù)器的安裝及管理-wuftp

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

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

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

            wu-ftpd主要有以下6個(gè)配置文件:

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

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

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

            ftphosts(設(shè)定個(gè)別的用戶權(quán)限)

            ftpservers(設(shè)定不同IP/Domain Name以對(duì)應(yīng)到不同的虛擬主機(jī))

            ftpusers(設(shè)定哪些帳號(hào)不能用ftp連線)


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

            /etc/xinetd.conf文件內(nèi)容如下:
            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
            }


            相關(guān)文件:/etc/services
            ftp-data 20/tcp
            ftp 21/tcp

            2. ftp用戶(Anonymous FTP服務(wù)器需要用到)
            文件:/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

            相關(guān)命令: newaliases, 建立郵件別名


            二. 文件系統(tǒng)結(jié)構(gòu)
            1. Anonymous FTP 目錄結(jié)構(gòu)
            如下子目錄:
            bin(ls,gzip,tar等anonymous ftp用戶所要使用的二進(jìn)制可執(zhí)行文件)
            etc(passwd,group)
            lib(動(dòng)態(tài)連接庫(kù),ld-2.0.7.so, ld-linux.so.2, ldd ../bin/ls 等)
            pub(可下載文件)

            2. passwd及group文件
            不要使用系統(tǒng)的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

            確認(rèn)不要用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特殊一些,請(qǐng)參考Wu-ftpd-faq)


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

            三. 測(cè)試及調(diào)試
            egrep ftp /etc/inetd.conf
            ps ax |egrep inetd
            kill -HUP $PID

            $ftp localhost (or ftp 0)
            執(zhí)行l(wèi)s cd get 等指令看一下結(jié)果如何


            四. wu-ftpd FTP服務(wù)器進(jìn)程

            增強(qiáng)功能:
            . 允許根據(jù)用戶的ip地址或主機(jī),用戶名設(shè)置不同的類
            . 根據(jù)設(shè)置的類,管理員可以控制其訪問(wèn)權(quán)限,如防止anonymous用戶
            刪除文件或覆蓋已有的文件
            . 可以實(shí)現(xiàn)自動(dòng)執(zhí)行uncompress,compress,tar,gzip等功能
            . 可以記載所有的upload/download,及ftp client所發(fā)送的每個(gè)命令.
            . 允許平滑關(guān)掉ftp服務(wù)器

            相關(guān)配置文件:
            ftpaccess
            ftpconversions
            ftphosts
            ftpuser

            相關(guān)命令:
            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. 命令行選項(xiàng)
            -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時(shí)的實(shí)時(shí)壓縮或展開(on-the-fly).

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

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

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


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

            (3)限制訪問(wèn)
            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 可當(dāng)目錄下可用空間
            %L hostname
            %M 最大允許連接數(shù)
            %N 同一類中當(dāng)前連接數(shù)
            %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只在第一次更改時(shí)顯示

            (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
            服務(wù)器的upload,但別傳沒用的過(guò)大的文件)

            # 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.實(shí)用程序

            ftpcount
            ftpwho
            ftushut

            維護(hù):
            建立連接時(shí)最好使用相對(duì)路徑。
            根據(jù)軟件類別建立不同的子目錄。
            最好在每個(gè)目錄中建立相應(yīng)的說(shuō)明文件或index文件,方便用戶查找。

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

            草草久久久无码国产专区| 精品人妻伦一二三区久久| 久久无码国产专区精品| 日本久久中文字幕| 久久久久人妻一区精品果冻| 国产香蕉97碰碰久久人人| 狠狠精品干练久久久无码中文字幕 | 久久香蕉超碰97国产精品| 久久天天躁狠狠躁夜夜躁2O2O| 国产成人久久精品一区二区三区 | 亚洲国产成人久久综合区| 少妇久久久久久被弄到高潮| 久久精品国产色蜜蜜麻豆| 国产成人无码久久久精品一| 国产精品九九久久免费视频| 亚洲国产精品无码久久青草| 久久久久久夜精品精品免费啦 | 日本国产精品久久| 777午夜精品久久av蜜臀| 91精品国产综合久久四虎久久无码一级 | 国产精品久久久久久影院| 久久久久久亚洲精品无码| 一本一本久久a久久综合精品蜜桃 一本一道久久综合狠狠老 | 久久精品中文无码资源站| 国产精品久久久久影院色| 国产成人久久精品一区二区三区| 99精品久久精品一区二区| 国产A三级久久精品| 久久久久亚洲精品无码网址 | 91久久国产视频| 无码专区久久综合久中文字幕| 狠狠色丁香婷婷综合久久来来去 | 东方aⅴ免费观看久久av| 国产精品成人久久久久三级午夜电影 | 久久亚洲国产成人精品无码区| 99久久精品毛片免费播放| 伊人久久精品无码av一区| 国产aⅴ激情无码久久| 91麻豆国产精品91久久久| 婷婷久久综合九色综合绿巨人| 精品免费久久久久国产一区|