① 如何在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鏂囦欢澶逛腑镎崭綔锛屽悗闱㈢殑姣旇缉澶嶆潅锛屾垜璇曡瘯浠ュぇ瀛︽暀鎺堢殑姘村钩鐢ㄧ亩鍗旷殑璇瑷璁层