① 如何在linux下開啟FTP服務
Linux下ftp服務可以通過搭建vsftpd服務來實現,以CentOS為例,首先查看系統中是否安裝了vsftpd,可以通過執行命令rpm -qa |grepvsftpd來查看是否安裝相應的包,如果沒有安裝那麼可以執行yum-yinstallvsftpd來安裝,安裝之後首先創建ftp用戶,比如ftp_test,命令如下:
useradd-s/sbin/nologin-d/home/ftp_testftp_test
目錄盡量不要選擇根目錄下,這里是/home/ftp_test,並且ftp_test這個目錄不要手動創建,否則許可權會有問題,執行命令的時候會自動創建,
現在可以看到上面的路徑是一個/,對於ftp用戶來說也就是根目錄了,只能在這個目錄下操作,而無法跳出這個目錄
以上就是vsftpd服務的基本搭建過程,實際使用時可以分配多個用戶
② linux涓嬬敤Proftpd鎼寤篺tp鏈嶅姟鍣ㄥ強閰嶇疆
linux涓嬫惌寤篺tp鏈嶅姟鍣ㄧ殑杞浠舵槸wuftp錛岀幇鍦ㄧ湡鐨勬椂浠e彉浜嗭紝涓婄綉鐪嬩竴涓嬪嚑涔庡叏涓栫晫鐨勪漢閮界敤proftpd浜!璧朵釜娼嫻侊紝鎴戜篃鐢╬roftpd鍦ㄥ叕鍙哥殑涓鍙板囩敤灝忔湇鍔″櫒涓婅呬笂ftp鏈嶅姟鍣ㄣ
棣栧厛proftpd鏄涓涓寮婧愯蔣浠訛紝鐩鍓嶆渶楂樼増鏈鏄錛1.3.1(闈炵ǔ瀹氱増)錛岀ǔ瀹氱殑鐗堟湰鏄1.3.0錛屼笅杞芥枃浠朵負proftpd-1.3.0a.tar.gz
鎴戜笅杞界殑鏄1.3.0錛屼笂浼犲埌鏈嶅姟鍣ㄤ笂鍚庢寜鐓у父瑙勭殑鏂規硶瀹夎呭嵆鍙銆
tar -zxvf proftpd-1.3.0a.tar.gz
cd proftpd*
./configure --prefix=/usr/local/proftpd
make
make install
瀹夎呭畬鎴!鎺ヤ笅鏉ユ槸閰嶇疆銆
璁劇疆涓錛氶殢鏈哄惎鍔ㄦ湇鍔★紝sbin/proftpd鏂囦歡澶嶅埗鍒/etc/rc.d/rc.local鏂囦歡澶逛腑錛屼互瀹炵幇寮鏈鴻嚜鍔ㄥ惎鍔ㄣ
璁劇疆浜岋細閰嶇疆鏂囦歡鍦╡tc/proftpd.conf錛岄厤緗鏂囦歡璇存槑濡備笅錛
ServerName "ProFTPD Default Installation"
ServerType standalone
DefaultServer on
鍒嗗埆琛ㄧず錛氭湇鍔″櫒鍚嶇О錛屾湇鍔$被鍨嬪拰榛樿ゆ湇鍔$姸鎬!
鍚庨潰鐨勬湇鍔$鍙e晩浠涔堢殑鎴戝氨鐪佸幓涓嶈翠簡錛岃存渶鍏抽敭鐨勬潈闄愭帶鍒墮儴鍒嗐
# Set the user and group under which the server will run.
User nobody
Group nogroup
娉ㄦ剰鐪嬩笂闈錛氫互浠涔堢敤鎴峰拰浠涔堢粍鏉ヨ繍琛屾湇鍔°
鏇存敼涓轟綘鐜版湁鐨勭粍鍜岀敤鎴鳳紝榪欓噷涓轟簡綆$悊涓婄殑鏂逛究鍜屽畨鍏ㄦт笂鑰冭檻錛屽緩璁鏂板緩涓涓猣tp緇勫拰ftp鐢ㄦ埛銆
# To cause every FTP user to be "jailed" (chrooted) into their home
# directory, uncomment this line.
#DefaultRoot ~
鏄鍚﹀厑璁哥敤鎴瘋繘鍏ョ敤鎴風殑涓葷洰褰曪紝娉ㄦ剰錛氬彲鏄閫傜敤/home鏇誇唬
# Normally, we want files to be overwriteable.
AllowOverwrite on
鏄鍚﹀叿鏈夐噸鍐欑殑鏉冨埄
# A basic anonymous configuration, no upload directories. If you do not
# want anonymous users, simply delete this entire section.
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 10
# 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
DenyAll
榪欓儴鍒嗘槸鍖垮悕鐢ㄦ埛鐨勫畾涔夊叾瀹炰篃寰堢畝鍗曘
鍚鍔ㄤ笉浜嗭紝鍑虹幇濡備笅閿欒鐨勮В鍐蟲柟娉
[root@new-host sbin]# ./proftpd
- IPv4 getaddrinfo 'new-host' error: Name or service not known
- warning: unable to determine IP address of 'new-host'
- error: no valid servers configured
- Fatal: error processing configuration file '/usr/local/proftpd/etc/proftpd.conf'
鍘熷洜鏄鏃犳硶緇戝畾Ip鍦板潃銆
鍦ㄩ厤緗鏂囦歡涓澧炲姞涓嬮潰榪欏彞錛
DefaultAddress 192.168.8.105
鍐嶉噸鍚鏈嶅姟灝卞彲浠ヤ簡!
鎺ヤ笂!鍘熸潵浠ヤ負榪欐牱灝卞畬浜嬩簡錛屽彲鏄鐪嬬湅鎵嶇煡閬撳傛灉鎴戣佹柊澧炲姞涓涓狥TP鐢ㄦ埛鐨勮瘽瀹為檯涓婃槸寰堥夯鐑︾殑涓浠朵簨錛屽洜涓哄笎鍙鋒槸鐩存帴璺熺郴緇熷笎鍙鋒兂鍏寵仈鐨勶紝涓嶅畨鍏ㄤ篃涓嶅ソ鎿嶄綔錛屾垜浠鐨勭洰鐨勬槸瑕佸仛鎴愬儚鉶氭嫙涓繪満鏈嶅姟鎻愪緵鍟嗛偅鏍風殑ftp!
鎺ヤ笅鍘伙紝闇瑕佷竴涓妯″潡鐨勬敮鎸佸埌 鍘葷湅鐪媝roftpd-mod-quotatab妯″潡錛屾敞鎰忎笅闈㈣繖鍙ヨ瘽錛
NOTE: mod_quotatab became part of the offical ProFTPD source distribution in 1.2.10rc1. If using a version of ProFTPD later than that, please use the mod_quotatab already included, as it will be most up-to-date.
琛ㄧず鎴戜滑涓嬭澆鐨1.3鐗堟湰宸茬粡鏀鎸佸仛浜嗚繖涓涓滆タ錛屼富瑕佺紪璇戝畨瑁呯殑鏃跺欐妸mod_quotatab 寮璧鋒潵灝卞彲浠ヤ簡錛屼簬鏄閲嶆柊緙栬瘧!
鍓嶆彁錛氱『璁や綘宸茬粡瀹夎呭苟涓旇兘澶熸e父榪愯宮ysql錛屽惁鍒欏悗闈㈢殑宸ヤ綔閮芥槸娌℃湁鎰忎箟鐨勪簡!
閲嶆柊緙栬瘧錛
./configure --prefix=/usr/local/proftpd --with-moles=mod_sql:mod_sql_mysql:mod_quotatab:mod_quotatab_sql --with-includes=/usr/include/mysql --with-libraries=/usr/lib/mysql
娉ㄦ剰璇鋒牴鎹鑷宸辯殑Linux緋葷粺鎵懼埌MySQL鐨勭浉搴攊nclude鍜宭ib鐩褰曪紝浠ヤ笂渚嬪瓙涓鐨勭浉鍏寵礬寰勬槸澶у氭暟Linux緋葷粺榛樿ょ殑錛屽傛灉浣犵殑MySQL鏄閫氳繃婧愮爜緙栬瘧瀹夎呯殑錛屽垯榪欎袱涓鐩褰曚竴鑸鍦ㄥ畨瑁呰礬寰勪笅銆
鏈夎祫鏂欒達細闇瑕佷慨鏀筩ontrib鐩褰曚腑mod_sql_mysql.c鏂囦歡錛
vi mod_sql_mysql.c
鎵懼埌#include 榪欎竴琛岋紝灝唌ysql.h鏀規垚浣犵殑緋葷粺涓姝ゆ枃浠舵墍鍦ㄧ殑璺寰勶紝濡/usr/include/mysql/mysql.h
鍙鏄鎴戞病鏈夎繖鏍峰仛涔熷彲浠ワ紝鐪熷囨!
鐒跺悗make
make install
涓鏍風殑鍒囨崲鍒皃roftpd鏂囦歡澶逛腑鎿嶄綔錛屽悗闈㈢殑姣旇緝澶嶆潅錛屾垜璇曡瘯浠ュぇ瀛︽暀鎺堢殑姘村鉤鐢ㄧ畝鍗曠殑璇璦璁層