Proftpd 大蝦的學(xué)習(xí)筆記
圖-ProFTPD
Proftpd 大蝦的學(xué)習(xí)筆記
雖然網(wǎng)上有很多關(guān)于Proftpd的配置資料,但是我在參考網(wǎng)上資料配置時(shí)出現(xiàn)挺多問題,走了滿多彎路,呵呵!!!嘻!!!把配置過程再重溫一遍吧,嘻!(我用的系統(tǒng)是as4.0的)
我配置是一個(gè)簡單的FTP服務(wù)器,所達(dá)到的要求是:
1、 允許匿名訪問
2、 允許skate用戶能夠上傳文件而不能進(jìn)行刪除和修改之類的權(quán)限
3、 允許tc用戶可以對整個(gè)FTP進(jìn)行上傳修改和刪除的所有的權(quán)限
準(zhǔn)備好了,現(xiàn)在開始了!!
一、安裝proftpd軟件(注意哦:我每一次安裝時(shí)是用測試版的,就是proftpd-1.3.0rc1版的,之后出現(xiàn)了嚴(yán)重的錯(cuò)誤,這個(gè)版不穩(wěn)定,大家如果不是玩玩的話就不要用測試版的,會氣死的!!
),http://www.proftpd.org.下載下來的是一個(gè)壓縮包,用
tar zxvf proftpd-1.2.10tar.gz 進(jìn)行解壓
cd proftpd-1.2.10 進(jìn)入proftpd-1.2.10文件夾
./configure –-prefix=/etc/proftpd 把proftpd-1.2.10安裝到/etc/proftpd文件夾下
Make
Make install
二、新建skate,tc用戶
groupadd skate 創(chuàng)建一個(gè)skate組
useradd skate –g skate –d /var/ftp/skate –s /sbin/nologin 這句話我的理解是(新建skate用戶,并把它加入skate組,把skate的目錄建在/var/ftp目錄下,并指定它的shell為nologin,這個(gè)nologin并不能讓skate用戶進(jìn)入linux系統(tǒng)
passwd skate 設(shè)置skate的密碼
useradd –d /var/ftp tc 添加tc用戶,并把它的家目錄建在/var/ftp,這樣只要此用戶登錄的話可以直接進(jìn)入ftp的目錄下
passwd tc 設(shè)置tc的密碼
- gpasswd -a skate tc
- gpasswd -a tc skate
- chown tc.tc /var/ftp
- chmod -R 770 skate
- cd ..
- chmod -R 775 ftp
- vi /etc/proftpd/etc/proftpd.conf
- service proftpd start
- service proftpd restart
- chmod 775 ftp
- chmod -R 770 skate
好了,用戶設(shè)置好了?。骸?
三、在開始配置proftpd.conf文件之前進(jìn)行以下操作:
1、因?yàn)槲矣玫氖羌t帽子AS4.0的,所以先要把自帶的vsftpd給停掉
service vsftpd stop 或者直接 rpm –e vsftpd
2、設(shè)置一個(gè)proftpd的啟動(dòng)服務(wù)
編輯一個(gè)啟動(dòng)腳本,
cd proftpd-1.2.10 進(jìn)入proftpd-1.2.10的解壓文件夾中
cp contrib/dist/rpm/proftpd.init.d /etc/rc.d/init.d/proftpd 拷貝proftpd.init.d到/etc/rc.d/init.d文件夾中,并改名為proftpd
vi /etc/rc.d/init.d/proftpd 編輯這個(gè)文件,找到文件中有一行是PATH行,將它改成你所安裝proftpd所在的目錄。PATH=’$PATH:/etc/proftpd/sbin:/etc/proftpd/bin’ 我是安裝在/etc/proftpd文件下,保存退出
3、把/etc/rc.d/init.d/proftpd設(shè)成可執(zhí)行文件
chmod +x /etc/rc.d/init.d/proftpd
chkonfig –add proftpd
這樣就可以用service proftpd start和service proftpd stop 和service proftpd restart來分別執(zhí)行開啟服務(wù),停止服務(wù)與重啟服務(wù)
4、現(xiàn)在你用service proftpd start是不是會出現(xiàn)個(gè)錯(cuò)誤,差點(diǎn)忘了要改配置文件了,嘻
vi /etc/proftpd/etc/proftpd.conf
在全局配置里把group的值為nogroup改成nobody
好了,配置前的工作做好了
#p#
四、現(xiàn)在正式來配置proftpd.conf里的權(quán)限設(shè)置,
vi /etc/proftpd/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 "ProFTPD Default Installation"
ServerType standalone
DefaultServer 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 nobody
Group nobody (這邊就是我在上一步所講的設(shè)置成nobody)
- # To cause every FTP user to be "jailed" (chrooted) into their home
- # directory, uncomment this line.
DefaultRoot ~ skate,skate (阻止skate組的用戶到其他目錄,它們只能呆在自家目錄)
# Normally, we want files to be overwriteable.
AllowOverwrite on
# Bar use of SITE CHMOD by default
DenyAll
- # 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
AllowOverwrite on
AllowStoreRestart on
#AllowForeignAddress on
AllowAll
DenyUser skate
; (這幾句是對skate用戶的權(quán)限限制,只允許它對/var/ftp/skate有寫的權(quán)限,不允許它有DELE RNFR RNTO RMD XRMD的權(quán)限)
AllowUser tc
; (這幾句是對tc的權(quán)限設(shè)置,給它對/var/ftp目錄擁有所有的權(quán)限,這個(gè)用戶也算是FTP的管理員帳戶吧。)
存盤退出
service proftpd restart
五、修改一下/var/ftp目錄的權(quán)限
chmod –R 775 /var/ftp
這樣tc對/var/ftp/skate的文件具有寫,刪,改,執(zhí)行的所有權(quán)限。
六、試驗(yàn)一下吧,嘻
后續(xù):
這個(gè)我***次在網(wǎng)上發(fā)表筆記,平時(shí)都是記在本子里,畢竟是要傳上去的,難免有點(diǎn)怕被扔香蕉皮,心里怪緊張的,嘻!我在配置之前我也是在網(wǎng)上看了好幾篇的配置筆記,上面都比我這要好多了,嘻,不是謙虛的哦!看完了是不是覺得挺少東西的,是啊,比如那些用戶限速之類的都沒提,還有一些語句的解釋,因?yàn)橐婚_始主要是想設(shè)置一下權(quán)限,只是權(quán)限弄好了,一切都好辦,你說對吧,嘻,不過還有一個(gè)原因是因?yàn)槲艺Z言表達(dá)能力不是很好,只能這樣將就了,嘻!!!
http://www.5ilinux.com/blog/archives/000082.html 這個(gè)網(wǎng)址比較好,里面每個(gè)細(xì)節(jié)都講得很清楚!!!!!大家一起努力吧,嘻!!!
通過文章的詳細(xì)介紹,是不是那些菜鳥都變成大蝦了么?Proftpd的知識獻(xiàn)給你們,快跟朋友分享吧!
【編輯推薦】
- ProFTPD 詳細(xì)解析
- Gentoo中的proftpd的一些問題
- Proftpd使用TLS/SSL
- Proftpd登陸速度慢
- 為什么要使用proftpd
- ProFTPD 主要特性
- 設(shè)定、編譯與安裝 proftpd
- 設(shè)定 xinetd 來啟動(dòng) proftpd