?? server_proftpd
字號:
安裝與配置proFTPd1>. install or compiling installsudo apt-get build-dep proftpd ordownload source and extract, then./configuremakemake install2>. server configured as inetd typeserverType inetd3>. configure file_(allowed user and anonymous login, also allowed anonymouts to download file and upload in ./uploads directory)/usr/local/etc/proftpd.conf# This is a basic ProFTPD configuration file (rename it to # 'proftpd.conf' for actual use. It establishes a single server# and a single anonymous login. It assumes that you have a user/group# "nobody" and "ftp" for normal operation and anon.ServerName "曾舟(zenger)的匿名(anonymous)ftp服務器"#ServerType standaloneServerType inetdDefaultServer on# Port 21 is the standard FTP port.Port 21# Umask 022 is a good standard umask to prevent new dirs and files# from being group and world writable.Umask 022# To prevent DoS attacks, set the maximum number of child processes# to 30. If you need to allow more than 30 concurrent connections# at once, simply increase this value. Note that this ONLY works# in standalone mode, in inetd mode you should use an inetd server# that allows you to limit maximum number of processes per service# (such as xinetd).MaxInstances 30# Set the user and group under which the server will run.User nobodyGroup nogroup# To cause every FTP user to be "jailed" (chrooted) into their home# directory, uncomment this line.#DefaultRoot ~# Normally, we want files to be overwriteable.AllowOverwrite on# Bar use of SITE CHMOD by default<Limit SITE_CHMOD> DenyAll</Limit># A basic anonymous configuration, no upload directories. If you do not# want anonymous users, simply delete this entire <Anonymous> section.<Anonymous ~ftp> #Allow logins if they are disabled above. <limit LOGIN> AllowAll </limit> User ftp Group ftp # We want clients to be able to login with "anonymous" as well as "ftp" UserAlias anonymous ftp # Limit the maximum number of anonymous logins MaxClients 5 "對不起已經達到 %m 的用戶上限--稍后再試" # We want 'welcome.msg' displayed at login, and '.message' displayed # in each newly chdired directory. DisplayLogin welcome.msg DisplayFirstChdir .message # Limit WRITE everywhere in the anonymous chroot <Limit WRITE> DenyAll </Limit> #An upload directory that allows storing file but not retrieving #or creating directories <Directory uploads/*> <Limit READ> DenyAll </Limit> <Limit STOR> AllowAll </Limit> </Directory></Anonymous>4>. configure the ftp service in inetd/etc/inetd.conf:ftp stream tcp nowait root /usr/sbin/tcpd /usr/local/sbin/proftpd#################################################################Linux下proftp學習筆記-配置全功略proftp學習筆記(一) 這幾天,公司終于放假了,終于可以安下心來好好學些proftp+mysql+quota。 安裝proftp之前,必須先做一個工作,假如你的mysql是自己編譯的,那就必須先修改/etc/ld.so.conf,否則后面運行proftp會報錯。 vi /etc/ld.so.conf 添加下面一行: 代碼: /usr/local/mysql/lib/mysql 注意大家如果mysql的安裝路徑于我不一樣,則填寫相應的路徑,有關mysql的編譯安裝請參考《Linux+Apache+Mysql+PHP典型配置》。 1。下載相關軟件 代碼: wget ftp://ftp.proftpd.org/distrib/source/proftpd-1.2.9.tar.gz 下載proftp的最新版本1.2.9 代碼: wget http://www.castaglia.org/proftpd ... tatab-1.2.11.tar.gz 這是配合proftp的磁盤限額的模塊 2。解壓編譯 代碼: tar zvxf proftpd-1.2.9.tar.gz tar zvxf proftpd-mod-quotatab-1.2.11.tar.gz cp mod_quotatab/*.c proftpd-1.2.9/contrib/ cp mod_quotatab/*.h proftpd-1.2.9/contrib/ vi proftpd-1.2.9/contrib/mod_sql_mysql.c 找到#include 這一行,將mysql.h改成你的系統中此文件所在的路徑,如/usr/local/mysql/include/mysql/mysql.h 編譯: 代碼: ./configure --prefix=/usr/local/proftpd --with-modules=mod_sql:mod_sql_mysql:mod_quotatab:mod_quotatab_sql --with-includes=/usr/local/mysql/include/mysql --with-libraries=/usr/local/mysql/lib/mysql make make install ok, 現在我們可以來啟動proftp了,只要 代碼: /usr/local/proftpd/sbin/proftpd 用你的ftp客戶端試驗以下,應該可以正常登陸,包括匿名和linux用戶名可以。 其實默認的proftp滿足日常的服務器管理用還是綽綽有余的,有個地方還是要修改一下,就是默認proftp的配置文件不支持ftp續傳,所以我們只要 代碼: vi /usr/local/proftpd/etc/proftpd.conf 添加以下兩行 代碼: AllowRetrieveRestart on AllowStoreRestart on 重新啟動以下proftp,就可以正常續傳文件了。 創建proftpd腳本 只要在proftp的源代碼目錄 代碼: cp proftpd-1.2.9/contrib/dist/rpm/proftpd.init.d /etc/rc.d/init.d/proftpd 記得修改proftpd文件,一般要修改proftpd的實際路徑 代碼: chmod 755 /etc/rc.d/init.d/proftpd ok 以后就可以用這個教本來啟動,停止,重啟proftp 呵呵,今天就講這些,明天講些proftp的一些基礎配置:) 原文地址:http://www.5ilinux.com/blog/archives/000085.html 轉載請注明出處和署名,并請保持一致 proftp學習筆記(二) 上次我們講了proftp的基本安裝,由于我們后面有關于mysql和quota的設置,所以編譯的時候把相應的模塊都編譯進去了,如果你不需要mysql和磁盤限額的功能,完全可以不需要這么編譯。 這里要講一個非常實用的命令, 代碼: /usr/local/proftpd/sbin/ftpshut 這個命令還是比較實用的,因為你可能需要不斷的調整你的服務器,而這個命令就非常靈活,可以在不停止proftpd進程的前提下,定時停止ftp連接,這里將會詳細說它是怎么使用的。 代碼: ftpshut [ -l min ] [ -d min ] time [ warning-message ... ] -l min: 在ftp關閉服務之前的幾分鐘內,嘗試建立新的ftp連接均不被接受 -d min: 在ftp關閉服務之前的幾分鐘內,已經建立的ftp連接將被中止 time: 在多少時間后,服務器將關閉ftp服務,格式有兩種 +number 經過number分鐘后關閉 MMHH 在今天MM:HH服務器將關閉 注意,這里我們用這個命令是把ftp服務給停了,但實際的proftpd進程還沒停止,所以一般調試ftp會使用到這個命令。 舉例: 再經過30分鐘后,FTP服務將關閉,在這之前的20分鐘不可接受任何新的ftp連接,已經建立的在服務關閉前10分鐘強制斷線,并在客戶端顯示“FTP Server Will shutdown at time” 代碼: ftpshut -l 20 -d 10 +30 "FTP Server Will shutdown at time" 其實ftpshut就是產生/etc/shutmsg ,你只要刪除這個文件ftp又可以重新服務,或者 直接 代碼: ftpshut -R 好了,開始講一些proftpd的基本配置吧,其實大家如果熟悉apache的配置的話,你會發現proftpd的設置基本都是類似的,它的配置基本格式是 代碼: #全局設置 設置項目1 參數1 設置項目2 參數2 #某個目錄的設置 <Directory "路徑名"> ... ... </Directory> #關于匿名用戶的設置 <Anonymous "匿名登陸的目錄"> ... ... <Limit 限制動作> ... ... </Limit> </Anonymous> 我們用到的比較多的可能是Limit的使用,Limit大致有以下動作,基本能覆蓋全部的權限了,大家靈活使用就是了。 代碼: CMD:Change Working Directory 改變目錄 MKD:MaKe Directory 建立目錄的權限 RNFR: ReName FRom 更改目錄名的權限 DELE:DELEte 刪除文件的權限 RMD:ReMove Directory 刪除目錄的權限 RETR:RETRieve 從服務端下載到客戶端的權限 STOR:STORe 從客戶端上傳到服務端的權限 READ:可讀的權限,不包括列目錄的權限,相當于RETR,STAT等 WRITE:寫文件或者目錄的權限,包括MKD和RMD DIRS:是否允許列目錄,相當于LIST,NLST等權限,還是比較實用的 ALL:所有權限 LOGIN:是否允許登陸的權限 針對上面這個Limit所應用的對象,又包括以下范圍 代碼: AllowUser 針對某個用戶允許的Limit DenyUser 針對某個用戶禁止的Limit AllowGroup 針對某個用戶組允許的Limit DenyGroup 針對某個用戶組禁止的Limit AllowAll 針對所有用戶組允許的Limit DenyAll 針對所有用戶禁止的Limit 關于限制速率的參數為: 代碼: TransferRate STOR|RETR 速度(Kbytes/s) user 使用者 下面我們以例子來解說proftp的配置,這樣大家可能更加容易理解。 1。ftp服務器支持斷點續傳,且最大支持同時10人在線,每個ip只允許一個連接; 2。允許ftpusers用戶組只能訪問自己的目錄,而不能訪問上級或者其他目錄; 3。用戶登陸服務器時不顯示ftp服務器版本信息,以增加安全性; 4。建立一個kaoyan的ftp帳戶,屬于ftpusers組,kaoyan用戶只允許下載,沒有可寫的權限。下載速率限制在50Kbytes/s。 5。建立一個upload用戶,也屬于ftpusers組,同kaoyan用戶的宿主目錄一樣,允許upload用戶上傳文件和創建目錄的權限,但不允許下載,并且不允許刪除目錄和文件的權限,上傳的速率控制在100Kbytes/s 先是前期的用戶和組添加以及目錄的權限設置 代碼: group add ftpusers useradd -d /home/kaoyan -g ftpusers -s /bin/fales kaoyan useradd -d /home/kaoyan -g ftpusers -s /bin/fales upload chown -R kaoyan:upload /home/kaoyan chmod -R 775 /home/kaoyan 如果你只想ftpusers組的用戶訪問,可以設置成770都行。 設置/usr/local/proftpd/etc/proftpd.conf 注意#表示注釋,對設置沒影響,可以不寫 代碼: ServerName "Frank's FTP Server" ServerType standalone DefaultServer on Port 21 Umask 022 MaxInstances 30 #最多有30個proftpd的PID User nobody Group nobody TimeoutStalled 10 MaxClients 10 #最多允許10個用戶在線 MaxClientsPerHost 1 "對不起,一個IP只允許一個連接" AllowStoreRestart on #允許斷點續傳(上傳),斷點續續(下載)是默認支持的,不用設置 DisplayLogin welcome.msg #歡迎詞文件 ServerIdent off #屏蔽服務器版本信息 DefaultRoot ~ ftpusers #設置ftpusers組只能訪問自己的目錄 <Directory /> AllowOverwrite on </Directory> <Directory /home/kaoyan> <Limit WRITE> #不允許寫 DenyUser kaoyan </Limit> <Limit RMD RNFR DELE RETR> #不允許刪除,改名,下載 DenyUser upload </Limit> TransferRate RETR 50 user kaoyan TransferRate STOR 100 user upload </Directory> 我這里實現的方式還可以通過 代碼: <Anonymous ~kaoyan> ... </Anonymous> <><Anonymous ~upload>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -