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